Skip to content

Node.js based forum software built for the modern web

fix: infinite scroll with small number of items #9524 (#9525)

gasovedcb1dd0a3db4d
diff --git a/public/src/client/infinitescroll.js b/public/src/client/infinitescroll.js
index 0ada79cd04..2f66ce91a8 100644
--- a/public/src/client/infinitescroll.js
+++ b/public/src/client/infinitescroll.js
@@ -10,15 +10,20 @@ define('forum/infinitescroll', function () {
var scrollTimeout = 0;
scroll.init = function (el, cb) {
+ const $body = $('body');
if (typeof el === 'function') {
callback = el;
- container = $('body');
+ container = $body;
} else {
callback = cb;
- container = el || $('body');
+ container = el || $body;
}
previousScrollTop = $(window).scrollTop();
$(window).off('scroll', startScrollTimeout).on('scroll', startScrollTimeout);
+
+ if ($body.height() <= $(window).height()) {
+ callback(1);
+ }
};
function startScrollTimeout() {