Fixed endless scroll loading next page too eagerly

This commit is contained in:
Marcin Kurczewski 2014-09-18 13:06:43 +02:00
parent 2c358b3c77
commit 9699aeaf64

View file

@ -148,15 +148,16 @@ App.Presenters.PagedCollectionPresenter = function(
if (!endlessScroll) {
return;
}
var $scroller = jQuery('<div/>');
window.clearInterval(scrollInterval);
scrollInterval = window.setInterval(function() {
if ($scroller.is(':visible')) {
var baseLine = $target.offset().top + $target.innerHeight();
var scrollY = jQuery(window).scrollTop() + jQuery(window).height();
if (scrollY > baseLine) {
nextPageInplace();
window.clearInterval(scrollInterval);
}
}, 50);
$target.append($scroller);
}, 100);
}
function refreshPageList() {