Are there any alternatives to the jQuery endless scrolling plugin?
http://www.beyondcoding.com/2009/01/15/release-jquery-plugin-endless-scroll/
This should take care of a bug where the user reaches the bottom of the page before the event fires. I was seeing this in my project you should check prior to initializing the event if you're already at the bottom of the page.
var scrollListener = function () {
executeScrollIfinBounds();
$(window).one("scroll", function () { //unbinds itself every time it fires
executeScrollIfinBounds();
setTimeout(scrollListener, 200); //rebinds itself after 200ms
});
};
$(document).ready(function () {
scrollListener();
});
function executeScrollIfinBounds()
{
if ($(window).scrollTop() >= $(document).height() - $(window).height() - 100) {
//Add something at the end of the page
}
}