Skip to content

Instantly share code, notes, and snippets.

@victoras
Created January 27, 2014 14:18
Show Gist options
  • Save victoras/8649312 to your computer and use it in GitHub Desktop.
Save victoras/8649312 to your computer and use it in GitHub Desktop.
infiniescroll
jQuery(document).ready(function () {
var container = document.querySelector('#js-masonry');
var msnry = new Masonry( container, {
// options
itemSelector: '.item'
});
});
jQuery('#js-masonry').infinitescroll({
navSelector : ".nav-next", // selector for the paged navigation (it will be hidden)
nextSelector : ".nav-next a", // selector for the NEXT link (to page 2)
itemSelector : ".item", // selector for all items you'll retrieve
errorCallback: function() {
// fade out the error message after 2 seconds
jQuery('#infscr-loading').animate({opacity: 0.8},2000).fadeOut('normal');
},
loading : {
msgText: "<em>Loading the next year of Grantees...</em>",
finishedMsg: "<em>You've reached the end of the Interviews.</em>"
},
});
jQuery(window).unbind('.infscr');
jQuery('.nav-next a').click(function(){
jQuery('#js-masonry').infinitescroll('retrieve');
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment