Last active
August 29, 2015 14:10
-
-
Save benjamingsmith/72e725cc981f4dabcbb1 to your computer and use it in GitHub Desktop.
Infinity Scroll
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
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