Skip to content

Instantly share code, notes, and snippets.

@jamilnyc
Created July 23, 2016 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamilnyc/2126550267b00e085b04e27cc96aa6bc to your computer and use it in GitHub Desktop.
Save jamilnyc/2126550267b00e085b04e27cc96aa6bc to your computer and use it in GitHub Desktop.
Configuring an Infinite Scroll Container with JScroll
console.log('Starting the scrolling script');
$('.infinite-scroll').jscroll({
debug: false, // Show debugging info in console
autoTrigger: true, // Start fetching without clicking a "next" link
autoTriggerUntil: false, // How many pages to auto trigger until requiring "next" click
loadingHtml: '<img src="/images/loading.gif" alt="Loading" />', // What to show when loading responses
padding: 20,
nextSelector: 'a.next-link:last', // The link with an href to the next response to load
callback: function () {
// Function called when the response is loaded
console.log('callback was called');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment