Usage:
npm i @three11/infinite-scroll
or
yarn add @three11/infinite-scroll
then
import InfiniteScroll from '@three11/infinite-scroll';
and then
const infiniteScroll = new InfiniteScroll();
or use custom settings
const infiniteScroll = new InfiniteScroll({
element: '.infinite-scroll-container',
next: '.infinite-scroll-next-page',
item: '.infinite-scroll-item',
disabledClass: 'is--disabled',
hiddenClass: 'is--hidden',
responseType: 'text/html',
viewportTriggerPoint: win.innerHeight - 200,
debounceTime: 100,
onComplete(container) {
console.log(container)
},
});