Show Images Only If They Are In Viewport Example



Instead of lazy loading, ldlazy is a lazy "showing" library that shows image only if they are in the viewport.
include the required files, which could be found in its Github repository:
Then, create and initialize the ldlazy instance:
To config ldlazy, pass an object with configs from any of following:
root - root element for monitoring scroll.toggle - when visibility changes, toggle will be called with the target node as param. default null.debounce - millisecond delay before handling events. require debounce.js, otherwise will be ignored.ldlz.add(n) - start monitoring node n for visibility change.ldlz.remove(n) - stop monitoring node n for visibility change.MIT License.