How to use @webcreate/infinite-ajax-scroll - 2 common examples

To help you get started, we’ve selected a few @webcreate/infinite-ajax-scroll examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webcreate / infinite-ajax-scroll / examples / blocks / index.js View on Github external
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'
});
github webcreate / infinite-ajax-scroll / examples / articles / index.js View on Github external
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;

@webcreate/infinite-ajax-scroll

Turn your existing pagination into infinite scrolling pages with ease

AGPL-3.0-only
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Popular @webcreate/infinite-ajax-scroll functions