Skip to content

Instantly share code, notes, and snippets.

@jq-87
Created December 2, 2013 16:43
Show Gist options
  • Save jq-87/7752407 to your computer and use it in GitHub Desktop.
Save jq-87/7752407 to your computer and use it in GitHub Desktop.
Detect when scroll position is at the bottom of page
$(window).scroll(function(){
var pageHeight = $(document).height(),
windowHeight = $(window).height(),
topDistance = $(document).scrollTop();
if( pageHeight - topDistance == windowHeight) {
//load more content now
console.log('reached the bottom');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment