You do not need to use a third-party plugin to achieve endless scrolling. You just need to listen to scrollstart or scrollstop and do some math.
You need $(window).scrollTop() , $.mobile.getScreenHeight() , $(".ui-content").outerHeight() , $(".ui-header").outerHeight() and $(".ui-footer").outerHeight() .
When the value of $(window).scrollTop() matches the height of the viewport minus the height of the content div height plus the height of the toolbars, it means that you have reached the bottom of the page.
Note that you must remove 1px from the found height of each fixed toolbar.
Attach the scrollstop listener to the document , and then define the variable heights.
$(document).on("scrollstop", function (e) { var activePage = $.mobile.pageContainer.pagecontainer("getActivePage"), scrolled = $(window).scrollTop(), screenHeight = $.mobile.getScreenHeight(), contentHeight = $(".ui-content", activePage).outerHeight(), header = $(".ui-header", activePage).outerHeight() - 1, footer = $(".ui-footer", activePage).outerHeight() - 1, scrollEnd = contentHeight - screenHeight + header + footer; if (activePage[0].id == "pageX" && scrolled >= scrollEnd) { addMore(); } });
Demo (1)
(1) Tested on iPhone 5 Safari Mobile
source share