diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-05 09:36:44 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-05 09:36:44 +0200 |
commit | cfa91dcf0aa25766dedfaa0205dc697389d07f2a (patch) | |
tree | 8620d13658f476fb5b0707bf3347151115e73af8 /js | |
parent | 5dda0084cdd6e5472f3c57903591ca37875d442f (diff) |
Fix mark as read on scroll
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'js')
-rw-r--r-- | js/directive/NewsScroll.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/js/directive/NewsScroll.js b/js/directive/NewsScroll.js index d83317fcb..552c7411f 100644 --- a/js/directive/NewsScroll.js +++ b/js/directive/NewsScroll.js @@ -47,9 +47,10 @@ app.directive('newsScroll', function ($timeout, ITEM_AUTO_PAGE_SIZE, var articles = elem.querySelectorAll('.item:not(.read)'); articles.forEach(function(article) { - var distTop = article.getBoundingClientRect().top; - var scrollTop = $(document).scrollTop(); - if (distTop - scrollTop <= -10) { + var distTop = article.offsetTop; + var scrollTop = window.pageYOffset || + document.documentElement.scrollTop; + if (distTop < scrollTop - 50) { ids.push(parseInt(article.dataset.id, 10)); } else { return false; |