mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-18 20:47:33 +01:00
fix case where container might be smaller than viewport
This commit is contained in:
@@ -22,8 +22,9 @@ define('forum/infinitescroll', ['translator'], function(translator) {
|
||||
|
||||
function onScroll() {
|
||||
var currentScrollTop = $(window).scrollTop();
|
||||
var wh = $(window).height();
|
||||
var offsetTop = container.offset() ? container.offset().top : 0;
|
||||
var scrollPercent = 100 * (currentScrollTop - offsetTop) / (container.height() - $(window).height());
|
||||
var scrollPercent = 100 * (currentScrollTop - offsetTop) / Math.max(wh, (container.height() - wh));
|
||||
|
||||
var top = 20, bottom = 80;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user