Jump to content
Search Community

Keeping ScrollTrigger same progress on resize

Ivan Mocs test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

i have problem with scrub position when window is resized, i found the code in this forum, by using scrolltrigger.create the problem is solved but when i move page the autoalpha position immediately becomes 0, without any transition.

 

i am using gsap.timeline and i am getting error in code

scrubNavHide.scroll

 

Screenshot 2022-09-18 091820.png

See the Pen MWGpMOZ by adeivan (@adeivan) on CodePen

Link to comment
Share on other sites

9 hours ago, GSAP Helper said:

It looks like your demo doesn't have any HTML or CSS in it, so it's rather useless. Can you please provide a proper minimal demo so we can see the issue in context? 

 

This definitely looks wrong: 

nav_hide.scroll(...)

That's a timeline which doesn't have a "scroll()" method. Perhaps you meant nav_hide.scrollTrigger.scroll(...)? 

See the Pen oNdWXqm by adeivan (@adeivan) on CodePen

 

this is the code, when windows is resized, the autoalpha value changes

Link to comment
Share on other sites

  • Solution

This is a LocomotiveScroll issue, unrelated to GSAP/ScrollTrigger. Please keep in mind that LocomotiveScroll is not a GreenSock product so we cannot support it. 

 

Here's a fork of your CodePen proving that when you try to call the scrollTo() method of LocomotiveScroll, it doesn't actually work properly (read the console): 

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

 

Also note that your previous demo was using the older LocomotiveScroll API for the scrollTo() method, but it looks like they updated it in v4 to have a different API (I fixed that in my fork above). 

 

You might want to consider using ScrollSmoother which is a GreenSock product and doesn't have these problems. https://greensock.com/scrollsmoother 👍

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