From 1783a07067dff9303ba92e753b40b46d3eb81114 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 28 Mar 2016 14:50:02 -0400 Subject: [PATCH] more tweaks to threshold --- public/less/global.less | 2 +- public/src/client/topic/posts.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/public/less/global.less b/public/less/global.less index d9f16c74e8..458fa4b8e6 100644 --- a/public/less/global.less +++ b/public/less/global.less @@ -14,7 +14,7 @@ &[data-state="unloaded"], &[data-state="loading"] { display: inherit; - height: 1rem; + height: 2rem; opacity: 0; } diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js index 5823d81b65..35e7ec5d29 100644 --- a/public/src/client/topic/posts.js +++ b/public/src/client/topic/posts.js @@ -10,7 +10,9 @@ define('forum/topic/posts', [ 'components' ], function(pagination, infinitescroll, postTools, navigator, components) { - var Posts = {}; + var Posts = { + _threshold: 0 + }; Posts.onNewPost = function(data) { if (!data || !data.posts || !data.posts.length) { @@ -255,6 +257,7 @@ define('forum/topic/posts', [ If no threshold is defined, loaded images will push down content, as per default */ + Posts._threshold = threshold; var images = components.get('post/content').find('img[data-state="unloaded"]'), visible = images.filter(function() { @@ -272,7 +275,7 @@ define('forum/topic/posts', [ newHeight = document.body.clientHeight; var imageRect = this.getBoundingClientRect(); - if (imageRect.top < threshold) { + if (imageRect.top < Posts._threshold) { scrollTop = scrollTop + (newHeight - oldHeight); $(window).scrollTop(scrollTop); }