Ray Thomas
Ray Thomas

Reputation: 1

Problem using scroll-snap css with javascript onScroll. They seem to cancel one another out

I need to identify when user is scrolling on my website. I think the javascript I'm running is having conflicts with the scroll-snap-type

I've tried playing around with the container height. If i make the height 100%, the javascript works, but the scroll snap does not.

code can be found here https://jsfiddle.net/raylthomas/kw6bn2a8/2/

window.onscroll = ()=> console.log("Scrolling...");

Upvotes: 0

Views: 278

Answers (1)

Jason
Jason

Reputation: 238

The conflict is due to the "overflow" rule, which is necessary for scroll-snap. My solution is to check for mousewheel activity by using window.onwheel()

Upvotes: 1

Related Questions