Return a Promise when any element is scroll past
$ npm install scroll-past
const scrollPast = require('scroll-past');
scrollPast(document.querySelector('.container')).then(pos => {
console.log(`I'm at ${pos}`);
});
Returns a Promise
that resolves the scrollY
position of the window.
Type: Element
The element to check for.
Type: number
Default: 0
Add a threshold to scroll past before the Promise
is returned.
MIT © Kevin Mårtensson