diff --git a/src/newsreader/js/pages/homepage/components/postlist/PostList.js b/src/newsreader/js/pages/homepage/components/postlist/PostList.js index 82617f8..8490e5f 100644 --- a/src/newsreader/js/pages/homepage/components/postlist/PostList.js +++ b/src/newsreader/js/pages/homepage/components/postlist/PostList.js @@ -21,13 +21,10 @@ class PostList extends React.Component { } checkScrollHeight(e) { - const currentHeight = window.scrollY + window.innerHeight; - const totalHeight = document.body.offsetHeight; - - const currentPercentage = (currentHeight / totalHeight) * 100; + const postList = document.body.querySelector('.posts__list'); if (this.props.next && !this.props.lastReached) { - if (currentPercentage > 60 && !this.props.isFetching) { + if (window.scrollY + window.innerHeight >= postList.offsetHeight) { this.paginate(); } }