Skip to content

Commit 0a17028

Browse files
committed
fix: take parentNode scrollHeight into account when using non-window scroller
1 parent ca66c1a commit 0a17028

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dist/InfiniteScroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ var InfiniteScroll = function (_Component) {
107107
} else if (this.props.isReverse) {
108108
offset = el.parentNode.scrollTop;
109109
} else {
110-
offset = el.scrollHeight - el.parentNode.scrollTop - el.parentNode.clientHeight;
110+
offset = el.parentNode.clientHeight - el.parentNode.scrollHeight - el.parentNode.scrollTop;
111111
}
112112

113113
if (offset < Number(this.props.threshold)) {

src/InfiniteScroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default class InfiniteScroll extends Component {
105105
} else if (this.props.isReverse) {
106106
offset = el.parentNode.scrollTop;
107107
} else {
108-
offset = el.scrollHeight - el.parentNode.scrollTop - el.parentNode.clientHeight;
108+
offset = el.parentNode.scrollHeight - el.parentNode.clientHeight - el.parentNode.scrollTop;
109109
}
110110

111111
if (offset < Number(this.props.threshold)) {

0 commit comments

Comments
 (0)