Jump to content
Search Community

Horizontal Scroll Anchors Using ScrollToPlugin

SaifUllah test
Moderator Tag

Recommended Posts

Hi Guys, I'm trying to create sections navigation on Horizontal Scroll, but my offsetLeft isn't calculating fine. could please have a look and let me know the issue, seems like this issue is because of ScrollTrigger end value/option but I really need this option and same value to make my Animations slower and smoother. What could be the possible solution to get 100% accurate offsetLeft without removing the ScrollTrigger end value?

 

Thanks.

See the Pen zYLQeLZ by saifullahbutt85 (@saifullahbutt85) on CodePen

Link to comment
Share on other sites

You're doing some highly customized things with the "fake pinning" horizontally which offsets things of course, thus you have to factor all that in to your scroll positions that you're correlating to your anchor links. It's beyond the scope of help we can provide for free in these forums, but if you're interested in paid consulting services, feel free to reach out to us and we can help you with this. 

 

In the meantime, this helper function may help, but it's not going to factor in your custom horizontal offsets (I'm only mentioning it here in case it helps as a starting point for you): 

https://greensock.com/docs/v3/HelperFunctions#getScrollLookup

 

Here are some other CodePens showing various approaches to linking in ways that factor in ScrollTrigger pinning (but again, none of them handle the custom horizontal offsets that fake pinning): 

See the Pen wvrXRdZ by GreenSock (@GreenSock) on CodePen

See the Pen poKEEKB?editors=0010 by GreenSock (@GreenSock) on CodePen

See the Pen xxjErmp?editors=1010 by GreenSock (@GreenSock) on CodePen

See the Pen NWYxBKO?editors=0010 by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

  • 4 months later...

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...