Али К Posted January 25, 2021 Share Posted January 25, 2021 Hey there, i want to add an function to my ScrollTrigger, but it's not working . i want to play this function on enter and pause it on leave Why it's not working , and how to fix it? See the Pen vYXqQZj by itsalimanuel (@itsalimanuel) on CodePen Link to comment Share on other sites More sharing options...
Solution ZachSaucier Posted January 25, 2021 Solution Share Posted January 25, 2021 Hey Ali. A function call is just a function call. You can't reverse a function call. Additionally it doesn't make much sense to use two timelines to do what you're doing - you should probably just use one timeline. Often times it's best to not rely on class names and CSS transitions for your animations. Using GSAP for all of your animation will give you far more control and keep all of your animations in a central location. Animating everything with GSAP will also prevent you from making some logical errors/creating conflicts. With that being said, if all you want to do is toggle multiple classes with a ScrollTrigger along with some pinning I would set it up this way: See the Pen XWjLoKV?editors=0010 by GreenSock (@GreenSock) on CodePen If that's not what you're trying to do, please make a new demo that reflects more closely what you're trying to do. 3 1 Link to comment Share on other sites More sharing options...
Али К Posted January 25, 2021 Author Share Posted January 25, 2021 Hey @ZachSaucier , it's working now, Thanks 😄 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now