Skip to content

Instantly share code, notes, and snippets.

@thesabbir
Created January 25, 2015 21:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thesabbir/51895c22439138a392db to your computer and use it in GitHub Desktop.
Save thesabbir/51895c22439138a392db to your computer and use it in GitHub Desktop.
Infinite Scrolling
var lastPos = 0;
var scrolling = $('#scrolling-item');
scrolling.on('scroll', function () {
var height = scrolling.height();
var scrollHeight = scrolling[0].scrollHeight;
var scrollTop = scrolling.scrollTop()+1;
if (lastPos < scrollTop) {
if (scrollTop >= scrollHeight - height) {
console.log('Loading..');
}
}
lastPos = scrollTop;
});
$scope.loadMore();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment