'How to do responsive scroll event with CSS and JS
I'm trying to make a responsive scrollY event using JS. I would like to animate a div on mobile and desktop. The problem is that on mobile, the animation appear at scrollY 2000 and on desktop scrollY 2800.
How can I animate it on desktop devices ?
There is the code I would like to use but it's not working:
if( window.scrollY > 2000 || window.scrollY > 2800){
percentDev.style.animation = "percentBareDev 2s forwards";
percentTeam.style.animation = "percentBareTeam 2s
forwards";
percentRewards.style.animation = "percentBareRewards 2s
forwards";
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
