Skip to content

Commit 492eae1

Browse files
committed
Use scrollingElement for clientHeight evaluation, if avaialble.
1 parent 515e9fc commit 492eae1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class ScrollTrigger extends Component {
6363
const element = ReactDOM.findDOMNode(this.element);
6464
const elementRect = element.getBoundingClientRect();
6565
const viewportStart = 0;
66-
const viewportEnd = document.body.clientHeight;
66+
const scrollingElement = document.scrollingElement || document.body;
67+
const viewportEnd = scrollingElement.clientHeight;
6768
const inViewport = elementRect.top < viewportEnd && elementRect.bottom > viewportStart;
6869

6970
const position = window.scrollY;

0 commit comments

Comments
 (0)