mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
@@ -10,15 +10,20 @@ define('forum/infinitescroll', function () {
|
|||||||
var scrollTimeout = 0;
|
var scrollTimeout = 0;
|
||||||
|
|
||||||
scroll.init = function (el, cb) {
|
scroll.init = function (el, cb) {
|
||||||
|
const $body = $('body');
|
||||||
if (typeof el === 'function') {
|
if (typeof el === 'function') {
|
||||||
callback = el;
|
callback = el;
|
||||||
container = $('body');
|
container = $body;
|
||||||
} else {
|
} else {
|
||||||
callback = cb;
|
callback = cb;
|
||||||
container = el || $('body');
|
container = el || $body;
|
||||||
}
|
}
|
||||||
previousScrollTop = $(window).scrollTop();
|
previousScrollTop = $(window).scrollTop();
|
||||||
$(window).off('scroll', startScrollTimeout).on('scroll', startScrollTimeout);
|
$(window).off('scroll', startScrollTimeout).on('scroll', startScrollTimeout);
|
||||||
|
|
||||||
|
if ($body.height() <= $(window).height()) {
|
||||||
|
callback(1);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function startScrollTimeout() {
|
function startScrollTimeout() {
|
||||||
|
|||||||
Reference in New Issue
Block a user