From e3b456c418916c315c2df040db9a4ec4278373a2 Mon Sep 17 00:00:00 2001 From: Andrew Joslin Date: Sun, 11 Jun 2017 09:41:02 -0600 Subject: [PATCH] fix: take parentNode scrollHeight into account when using non-window scroller --- dist/InfiniteScroll.js | 2 +- src/InfiniteScroll.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/InfiniteScroll.js b/dist/InfiniteScroll.js index 8decb7e..f78bec7 100644 --- a/dist/InfiniteScroll.js +++ b/dist/InfiniteScroll.js @@ -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)) { diff --git a/src/InfiniteScroll.js b/src/InfiniteScroll.js index 1d6be43..b81e6d2 100644 --- a/src/InfiniteScroll.js +++ b/src/InfiniteScroll.js @@ -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)) {