diff options
Diffstat (limited to 'js/directive/NewsScroll.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; |