in-view-js
v1.0.2
Published
Module for capturing element in viewport on native Javascript.
Downloads
2
Maintainers
Readme
in-view-js
Module for capturing element in viewport on native Javascript.
Demo: CodePen
Usage:
let element = document.getElementById('test'),
callback = (isInView) => console.log('is Element visible?', isInView),
overlapEl = document.getElementById('fixed-top-bar');
let inViewInstance = new InViewPort({
element,
callback,
overlapEl
});
inViewInstance.addListeners();
/* ... */
inViewInstance.removeListeners();
Feature: Added "overlapEl" for counting overlapping elements (fixed top bars).
Tested with ES6 modules.