Skip to content

Commit 506c82e

Browse files
committed
replace scrollY with pageYOffset for better support
1 parent 8bfbbfd commit 506c82e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libs/ParallaxScrollListener.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
const prevScrollY = scrollY;
4646

4747
// Save current scroll
48-
scrollY = window.scrollY;
48+
scrollY = window.pageYOffset; // Supports IE 9 and up.
4949

5050
// direction
5151
scrollDown = scrollY > prevScrollY;
@@ -132,7 +132,7 @@ import {
132132
const windowHeight = window.innerHeight || html.clientHeight;
133133
const elHeight = el.offsetHeight;
134134
const elWidth = el.offsetWidth;
135-
const scrollY = window.scrollY;
135+
const scrollY = window.pageYOffset;
136136

137137
// NOTE: offsetYMax and offsetYMin are percents
138138
// based of the height of the element. They must be

0 commit comments

Comments
 (0)