Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let offset = pageIndex * limit;
for (let i = offset, len = offset + limit; i < len; i++) {
let block = frag.appendChild(document.createElement('div'));
block.id = 'block' + (i + 1);
block.classList.add('blocks__block');
block.innerHTML = i + 1;
}
return this.append(Array.from(frag.childNodes))
// indicate that there is a next page to load
.then(() => true);
};
window.ias = new InfiniteAjaxScroll('.blocks', {
item: '.blocks__block',
next: nextHandler,
spinner: '.loader'
});
import InfiniteAjaxScroll from '@webcreate/infinite-ajax-scroll';
window.ias = new InfiniteAjaxScroll('.surface-container', {
item: '.article',
next: '.pager__next',
pagination: '.pager',
spinner: '.loader'
});
ias.on('last', function() {
let el = document.querySelector('.no-more');
el.style.opacity = '1';
});
// update title and url then scrolling through pages
ias.on('page', (e) => {
document.title = e.title;