1.0.1 • Published 4 years ago
@firstandthird/lazyload v1.0.1
Lazyload library
Installation
npm install @firstandthird/lazyload
or
yarn add @firstandthird/lazyload
Example
<img src="" data-lazy data-src="https://picsum.photos/seed/picsum/200/300" alt="">
import { lazyloadOptions, loadAllNow, init } from '@firstandthird/lazyload';
// Override options
lazyloadOptions.nativeLazyloadEnabled = false; // disables native loading="lazy"
lazyloadOptions.getOptions = () => ({
root: null,
rootMargin: `0px 0px 100px 0px`,
threshold: [0.2, 0.3, 1]
});
// Load all sources (ignores lazy loading)
loadAllNow();
See more examples.
A First+Third Project