diff --git a/public/src/client/infinitescroll.js b/public/src/client/infinitescroll.js index 95f46d88e3..f55b3499df 100644 --- a/public/src/client/infinitescroll.js +++ b/public/src/client/infinitescroll.js @@ -31,10 +31,14 @@ define('forum/infinitescroll', ['translator'], function(translator) { var top = 20, bottom = 80; + var direction = currentScrollTop > previousScrollTop ? 1 : -1; + if (scrollPercent < top && currentScrollTop < previousScrollTop) { - callback(-1); + callback(direction); } else if (scrollPercent > bottom && currentScrollTop > previousScrollTop) { - callback(1); + callback(direction); + } else if (scrollPercent < 0 && direction > 0 && viewportHeight < 0) { + callback(direction); } previousScrollTop = currentScrollTop;