From b6f7014a9df678850c0048deebe941c1bb8cfcbd Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 23 Sep 2014 13:04:54 -0400 Subject: [PATCH] fixed infinite scroller so that it takes the height of OP into account when detecting when to load more posts while scrolling up --- public/src/forum/infinitescroll.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/src/forum/infinitescroll.js b/public/src/forum/infinitescroll.js index 870f555a8c..ac0787a023 100644 --- a/public/src/forum/infinitescroll.js +++ b/public/src/forum/infinitescroll.js @@ -17,9 +17,10 @@ define('forum/infinitescroll', function() { }; function onScroll() { - var top = $(window).height() * 0.1 + topOffset; - var bottom = ($(document).height() - $(window).height()) * 0.9; - var currentScrollTop = $(window).scrollTop(); + var originalPostEl = $('li[data-index="0"]'), + top = $(window).height() * 0.15 + topOffset + (originalPostEl ? originalPostEl.outerHeight() : 0), + bottom = ($(document).height() - $(window).height()) * 0.85, + currentScrollTop = $(window).scrollTop(); if(currentScrollTop < top && currentScrollTop < previousScrollTop) { callback(-1);