Jump to content
Search Community

ScrollTrigger actions sometimes never called after a resize

benrbnt
Moderator Tag

Recommended Posts

Posted

Hello, I have an issue I can't manage trop reproduce in a simple codepen (available here: ) but as a demo, here is a video where the "bug" occurs.

 

I don't have any specific ScrollTrigger configuration. My ScrollTrigger config in the video is the exact same one as the one in the codepen.

 

I use Lenis, added it in the Codepen too, and it looks like it is not the issue here :( 

 

 

See the Pen QWZJEEQ?editors=1111 by benjaminrobinet (@benjaminrobinet) on CodePen.

Posted

Hi,

 

What is exactly the issue we should be looking at? You didn't describe what's the problem in the video.

 

Finally as you mention in Codepen everything works as expected. The demo is using the latest version of GSAP and ScrollTrigger. Be sure to use 3.11.5 in your development environment, for the GSAP Core and any Plugin you're using.

 

Happy Tweening!

  • 2 weeks later...
Posted

@Rodrigo Hello! Sorry for my late answer. In the video I console.log in different actions callbacks (enter, enter back, leave, leave back).

As you can see when I "leave back" the trigger when resizing, the action is not called. 

Posted

Hi,

 

I just checked your codepen and after a resize everything works as expected. I keep seeing all the callbacks there, maybe I'm missing something ?‍♂️

 

There could be something else in your setup that's causing this, unfortunately a video doesn't tell us the whole story and as stated before your codepen is working as expected.

 

One alternative could be to test next release's beta files:

https://assets.codepen.io/16327/gsap-latest-beta.min.js

https://assets.codepen.io/16327/ScrollTrigger.min.js

 

Give those a try and let us know.

Hopefully this helps.

Happy Tweening!

Posted

@Rodrigo I might have a guess for the issue: I use gsap matchMedia scope for my ScrollTriggers, so when I resize, sometimes the ScrollTrigger is re-created then the action of the previously created ScrollTrigger won't be called.

 

As a fix, in my case I could just use the cleanup function of the scope.

 

Sorry for not having been clear enough. Thanks for your help :) 

Posted

Hi,

 

Have you checked this example?

See the Pen KKoMpMv by GreenSock (@GreenSock) on CodePen.

 

I'm curious about what's not working for you. If possible, could you create a codepen example or update the one you already created with this issue you're seeing?

 

Happy Tweening!

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