Jump to content
Search Community

ScrollTo plugin not firing after first trigger in a Timeline

kenma test
Moderator Tag

Go to solution Solved by kenma,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi all,

 

Firstly, thank you for this wonderful tool!

I'm having some issues combining the ScrollToPlugin with TimelineMax. What I'm doing is basically a bunch of animations in a TimelineMax ending with a scrollTo at the end (to move to another section). This works the first time, but scrolling back up and down again has some issues. The animations all fire properly, but the ending scrollTo doesn't work (is only fired the very first time).

 

Is this a known bug or intended behaviour?

Link to comment
Share on other sites

Welcome to the forums.

 

I wonder if maybe you've got an overwrite happening in your code, like if multiple scrollTo values are being applied to the same object at the same time, GSAP senses that and kills the prior tween. It's really tough to troubleshoot blind, so I'm totally guessing here. You could try:

  1. Set TweenLite.defaultOverwrite = false; just to see if that eliminates the problem. It's not a great long-term solution, but at least it'll help you know if that's the issue. 
  2. Set autoKill:false in your scrollTo tween. See https://greensock.com/docs/#/HTML5/GSAP/Plugins/ScrollToPlugin/
  • Like 1
Link to comment
Share on other sites

  • Solution

Thanks for the quick response. I actually figured out a clean workaround shortly after making the post. If it helps with diagnosing this issue: I already had autoKill: false set without any positive effect.

 

I fixed this by adding an onComplete hook to my TimelineMax, firing a TweenMax.to(..scrollTo..) animation, giving me the desired effect.

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