From c24a8c0742d8647251983c1bdca08d58c3bb93ff Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 20 Nov 2021 18:16:21 +0000 Subject: [PATCH] fixed leaderboard scrolling. closes #2096 --- src/js/elements/leaderboards.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/js/elements/leaderboards.js b/src/js/elements/leaderboards.js index fd6f58b23..0c658c463 100644 --- a/src/js/elements/leaderboards.js +++ b/src/js/elements/leaderboards.js @@ -451,7 +451,7 @@ let leftScrollEnabled = true; $("#leaderboardsWrapper #leaderboards .leftTableWrapper").scroll((e) => { if (!leftScrollEnabled) return; let elem = $(e.currentTarget); - if (elem.scrollTop() == 0) { + if (Math.round(elem.scrollTop()) <= 50) { requestMore(15, true); } }); @@ -459,7 +459,10 @@ $("#leaderboardsWrapper #leaderboards .leftTableWrapper").scroll((e) => { $("#leaderboardsWrapper #leaderboards .leftTableWrapper").scroll((e) => { if (!leftScrollEnabled) return; let elem = $(e.currentTarget); - if (elem[0].scrollHeight - elem.scrollTop() <= elem.outerHeight()) { + if ( + Math.round(elem[0].scrollHeight - elem.scrollTop()) <= + Math.round(elem.outerHeight()) + 50 + ) { requestMore(15); } }); @@ -469,14 +472,17 @@ let rightScrollEnabled = true; $("#leaderboardsWrapper #leaderboards .rightTableWrapper").scroll((e) => { if (!rightScrollEnabled) return; let elem = $(e.currentTarget); - if (elem.scrollTop() == 0) { + if (Math.round(elem.scrollTop()) <= 50) { requestMore(60, true); } }); $("#leaderboardsWrapper #leaderboards .rightTableWrapper").scroll((e) => { let elem = $(e.currentTarget); - if (elem[0].scrollHeight - elem.scrollTop() <= elem.outerHeight()) { + if ( + Math.round(elem[0].scrollHeight - elem.scrollTop()) <= + Math.round(elem.outerHeight() + 50) + ) { requestMore(60); } });