1.0.7 • Published 8 years ago

pigro v1.0.7

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

pigro.js npm

A small lazy loader for images, videos etc. built using the intersection observer API. To learn more about the API and how supported it is refer to: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API

Installation

# Install using Yarn.
$ yarn add pigro

# Install using npm.
$ npm install pigro

Usage

In your HTML:

<img class="pigro" data-src="lazy-image.jpg" />

In your JavaScript:

import pigro from 'pigro';
const lazyLoader = pigro(); // initialize new loader
lazyLoader.watch(); // watch elements to lazyload

By default Pigro will use the selector .pigro to determine which elements to lazy load and the following configuration:

defaultSettings = {
  rootMargin: '0px',
  threshold: 0
};

It is possible to create a new watcher with a custom selector and configuration:

const lazyLoader = pigro('.customLazy', {
  rootMargin: '3px',
  threshold: 1.0
});
1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago