Jump to content
Search Community

Issues with ScrollTrigger + ScrollTo navigation

dvdslns test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Hi all! I'm having some issues trying to recreate a functionality similar to fullPage.js. Based on this post and the pens posted I could replicate a "snap to section" effect on scroll, but my issue is when I try to navigate to different sections using scrollTo.

 

My issue is that navigation anchors only skip to adjacent sections. I think it's because the onEnter and onEnterBack callbacks.

 

How could I "override" this actions and make the scrollTo anchors jump to the right section?

 

Thanks in advance!

See the Pen wvJXegB by omaidog (@omaidog) on CodePen

Link to comment
Share on other sites

  • Solution
16 hours ago, elegantseagulls said:

You could probably set a variable to determine if the nav has been clicked/is actively animating and make your goToSection() tween conditional based on that.

 

This thread shows an example of that - maybe it helps:

 

 

 

  • Like 3
Link to comment
Share on other sites

 

10 hours ago, akapowl said:

 

This thread shows an example of that - maybe it helps:

 

 

 

 

Thank you @elegantseagulls @akapowl, IT WORKS! I've updated the pen using @akapowl's example as reference.

@GreenSock note taken! I can imagine that it can cause weird issues. The transitions were there to spice up a little the pen example but I figure that GSAP is the best tool for that too ❤️ 

  • Like 1
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...