Created
January 25, 2015 21:55
-
-
Save thesabbir/51895c22439138a392db to your computer and use it in GitHub Desktop.
Infinite Scrolling
This file contains hidden or 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 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