Jump to content

Search In
  • More options...
Find results that contain...
Find results in...
Ali Manuel

OnEnter m, OnLeave

Recommended Posts

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 post
Share on other sites

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.

  • Like 3
  • Thanks 1
Link to post
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.