Fast High-Performance Lazy Load Library – LazyObserver.js

Category: Image , Javascript , Loading | March 2, 2018
Author: tyczynski
Views Total: 606
Official Page: Go to website
Last Update: March 2, 2018
License: MIT

Preview:

Fast High-Performance Lazy Load Library – LazyObserver.js

Description:

Just another JavaScript library which makes uses of the Intersection Observer API to provide the fast, performant and modern lazy loading functionality on your images within the document. Supports both <img> tags and background images.

How to use it:

Install and import the LazyObserver.js library into your document.

# NPM
$ npm install lazyobserver --save
<script src="/path/to/LazyObserver.js"></script>

Initialize the lazyobserver library and specify the selector of the container which contains images and/or background images.

// default .lazyObserver
new LazyObserver('.lazyObserver');

Default configs.

new LazyObserver('.lazyObserver',{
    root: null,
    rootMargin: '0px 0px 0px 0px',
    threshold: 1.0,
    mounted: null, 
    loaded: null,
    error: null
});

You Might Be Interested In:

Leave a Reply