Skip to content

Commit

Permalink
fix: take parentNode scrollHeight into account when using non-window …
Browse files Browse the repository at this point in the history
…scroller
  • Loading branch information
ajoslin committed Jun 11, 2017
1 parent ca66c1a commit e3b456c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/InfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ var InfiniteScroll = function (_Component) {
} else if (this.props.isReverse) {
offset = el.parentNode.scrollTop;
} else {
offset = el.scrollHeight - el.parentNode.scrollTop - el.parentNode.clientHeight;
offset = el.parentNode.scrollHeight - el.parentNode.clientHeight - el.parentNode.scrollTop;
}

if (offset < Number(this.props.threshold)) {
Expand Down
2 changes: 1 addition & 1 deletion src/InfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default class InfiniteScroll extends Component {
} else if (this.props.isReverse) {
offset = el.parentNode.scrollTop;
} else {
offset = el.scrollHeight - el.parentNode.scrollTop - el.parentNode.clientHeight;
offset = el.parentNode.scrollHeight - el.parentNode.clientHeight - el.parentNode.scrollTop;
}

if (offset < Number(this.props.threshold)) {
Expand Down

0 comments on commit e3b456c

Please sign in to comment.