Jump to content
Search Community

Scroll event being called twice

mrfrancescomoro test
Moderator Tag

Recommended Posts

Hi everyone, I'm having some trouble with this script.

Basically what I'm trying to achieve is that on every mouse scroll event the page scroll to the next section and this the part that works; my problem is with the apple mouse, if you scroll to heavly, the scroll event seems to fire twice and that's the problem.

I'm not sure if the issue is within my gsap code or is just a vanilla js thing and I have to find a work-around to solve this.

 

 

 

See the Pen oNeYNvX by mrfrancescomoro (@mrfrancescomoro) on CodePen

Link to comment
Share on other sites

On 10/29/2021 at 9:19 PM, OSUblake said:

I'm not sure I see what the issue is. If I scroll really fast with my mouse wheel on free spin, it will scroll all the way to the end, but that's what I would expect as the mouse it still technically scrolling. Is that what you mean?

Yeah, that's right but if you give just one hit at the scroll, like during a normal navigation of a website, the event seems to be called twice and the page scroll for two sections instead of one. Does it happens to you too or it's just me?

If you think it's not a gsap problem, apologies and I'll close this thread. :) 

 

Link to comment
Share on other sites

Thank you guys for all the support, it turned out is just a mouse wheel problem!

As always, the mighty gsap is doing its works beautifully!
I've partially solved the problem disabling the scroll for longer period of time.

Maybe in the future I'll try to find a better solution but for now this will do the trick!

Thanks again!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...