diff --git a/src/InfiniteScroll.js b/src/InfiniteScroll.js index b08637e..7893579 100644 --- a/src/InfiniteScroll.js +++ b/src/InfiniteScroll.js @@ -204,7 +204,15 @@ export default class InfiniteScroll extends Component { } else if (this.props.isReverse) { offset = parentNode.scrollTop; } else { - offset = el.scrollHeight - parentNode.scrollTop - parentNode.clientHeight; + let relativeHeight = + el.getBoundingClientRect().top + + parentNode.scrollTop - + parentNode.getBoundingClientRect().top; + offset = + relativeHeight + + el.scrollHeight - + parentNode.scrollTop - + parentNode.clientHeight; } // Here we make sure the element is visible as well as checking the offset