Are there any alternatives to the jQuery endless scrolling plugin?
http://www.beyondcoding.com/2009/01/15/release-jquery-plugin-endless-scroll/
Combining Ergec's answer and Pere's comment:
function watchScrollPosition(callback, distance, interval) {
var $window = $(window),
$document = $(document);
var checkScrollPosition = function() {
var top = $document.height() - $window.height() - distance;
if ($window.scrollTop() >= top) {
callback();
}
};
setInterval(checkScrollPosition, interval);
}
distance
is the number of pixels from the bottom of the screen when the callback will fire.
interval
is how often the check will run (in milliseconds; 250-1000 is reasonable).