1.2.4 • Published 4 years ago

element-in-viewport v1.2.4

Weekly downloads
1,545
License
MIT
Repository
github
Last release
4 years ago

element-in-viewport

npm Build Status GitHub license

An async module that resolves when an element has entered the viewport at a certain percentage, using the Intersection Observer API.

Polyfilled with the Intersection Observer Polyfill

With the polyfill, IntersectionObserver has been tested and known to work in the following browsers:

Install:

npm i -S element-in-viewport

Example Usage:

import elementInViewport from 'element-in-viewport';

(async () => {

    const targetElement = document.querySelector('#targetElement');

    const entry = await elementInViewport(targetElement, 0);

    alert(`Intersection in Viewport Detected at IntersectionRatio ${entry.intersectionRatio}`);

})();
1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.0

6 years ago