Change loading posts from 80% to 100%
This commit is contained in:
parent
85e152f6e8
commit
f5b708aafe
1 changed files with 2 additions and 5 deletions
|
|
@ -21,13 +21,10 @@ class PostList extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkScrollHeight(e) {
|
checkScrollHeight(e) {
|
||||||
const currentHeight = window.scrollY + window.innerHeight;
|
const postList = document.body.querySelector('.posts__list');
|
||||||
const totalHeight = document.body.offsetHeight;
|
|
||||||
|
|
||||||
const currentPercentage = (currentHeight / totalHeight) * 100;
|
|
||||||
|
|
||||||
if (this.props.next && !this.props.lastReached) {
|
if (this.props.next && !this.props.lastReached) {
|
||||||
if (currentPercentage > 60 && !this.props.isFetching) {
|
if (window.scrollY + window.innerHeight >= postList.offsetHeight) {
|
||||||
this.paginate();
|
this.paginate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue