hd-intersection-observer
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

hd-intersection-observer

Is an abstract layer built on top of the IntersectionObserver Api, it would make it easier to use and more efficient to instantiate multiple observers.

Installation

npm install hd-intersection-observer

How to use

// will start observing the element if its on the view port
const observer = observeFunc(
document.body,
(isInView, entry) => {
// do something
},
// document or any HTML element of choice
{ root: document }
);

// When called it will unobserve the element (for cleanup).
observer();

Package Sidebar

Install

npm i hd-intersection-observer

Weekly Downloads

79

Version

1.1.1

License

MIT

Unpacked Size

56.4 kB

Total Files

12

Last publish

Collaborators

  • ahmad-hddad