Change loading posts from 80% to 100%

This commit is contained in:
Sonny Bakker 2021-07-24 20:18:42 +02:00
parent 85e152f6e8
commit f5b708aafe

View file

@ -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();
}
}