Created
January 27, 2014 14:18
-
-
Save victoras/8649312 to your computer and use it in GitHub Desktop.
infiniescroll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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