Skip to content

Instantly share code, notes, and snippets.

@benjamingsmith
Last active August 29, 2015 14:10
Show Gist options
  • Save benjamingsmith/72e725cc981f4dabcbb1 to your computer and use it in GitHub Desktop.
Save benjamingsmith/72e725cc981f4dabcbb1 to your computer and use it in GitHub Desktop.
Infinity Scroll
var killScroll = false;
$(container).bind('scroll', function() {
if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight && killScroll == false) {
// whatever you want to do when bottom is reached
killScroll = true;
// to prevent more loading
setTimeout(function(){killScroll = false}, 2000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment