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();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    46
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.1
    46
  • 1.1.0
    0
  • 1.0.1
    0
  • 1.0.0
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i hd-intersection-observer

Weekly Downloads

46

Version

1.1.1

License

MIT

Unpacked Size

56.4 kB

Total Files

12

Last publish

Collaborators

  • ahmad-hddad