Skip to content

Commit 3d73903

Browse files
authored
1 parent 54d7b16 commit 3d73903

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/InfiniteScroll.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,15 @@ export default class InfiniteScroll extends Component {
204204
} else if (this.props.isReverse) {
205205
offset = parentNode.scrollTop;
206206
} else {
207-
offset = el.scrollHeight - parentNode.scrollTop - parentNode.clientHeight;
207+
let relativeHeight =
208+
el.getBoundingClientRect().top +
209+
parentNode.scrollTop -
210+
parentNode.getBoundingClientRect().top;
211+
offset =
212+
relativeHeight +
213+
el.scrollHeight -
214+
parentNode.scrollTop -
215+
parentNode.clientHeight;
208216
}
209217

210218
// Here we make sure the element is visible as well as checking the offset

0 commit comments

Comments
 (0)