Skip to content

Commit 63900fe

Browse files
author
Karl
committed
Fixed how scroll position is read after it broke in Chrome 61. Fixes #2
1 parent fe8bede commit 63900fe

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ class BottomScrollListener extends Component {
1818
}
1919

2020
handleOnScroll() {
21-
if (document.body.scrollHeight - this.props.offset <= (document.body.scrollTop + window.innerHeight)) {
21+
const scrollNode = document.scrollingElement || document.documentElement;
22+
23+
if (scrollNode.scrollHeight - this.props.offset <= (scrollNode.scrollTop + window.innerHeight)) {
2224
this.props.onBottom();
2325
}
2426
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-bottom-scroll-listener",
3-
"version": "1.0.3",
3+
"version": "1.1.0",
44
"description": "A simple React component that lets you listen for when you have scrolled to the bottom.",
55
"main": "dist/react-bottom-scroll-listener.js",
66
"scripts": {

0 commit comments

Comments
 (0)