From e02e6705c08d05718bca0a04f26930397e432f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Wed, 5 Sep 2018 09:44:17 +0200 Subject: Use bottom of article MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- js/directive/NewsScroll.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/directive/NewsScroll.js b/js/directive/NewsScroll.js index 552c7411f..44271b72b 100644 --- a/js/directive/NewsScroll.js +++ b/js/directive/NewsScroll.js @@ -47,10 +47,11 @@ app.directive('newsScroll', function ($timeout, ITEM_AUTO_PAGE_SIZE, var articles = elem.querySelectorAll('.item:not(.read)'); articles.forEach(function(article) { - var distTop = article.offsetTop; + // distance to top + height + var distTop = article.offsetTop + article.offsetHeight; var scrollTop = window.pageYOffset || document.documentElement.scrollTop; - if (distTop < scrollTop - 50) { + if (distTop < scrollTop) { ids.push(parseInt(article.dataset.id, 10)); } else { return false; -- cgit v1.2.3