Jump to content
Search Community

Stop elements from restarting animation if already in viewport on ScrollTrigger.refresh()

bstnhnsl test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I'm using Scrolltrigger to animate some elements on my page when entering or leaving the viewport. I have a few places where I need to call ScrollTrigger.refresh() because content is removed from and added to the DOM. I dont want elements to animate again if they are already in the viewport. How can I achieve that?

 

See the demo:

Scroll down to trigger the headline animation. The Headline animates again if the button is clicked

 

See the Pen poVvVyM by bstnjns (@bstnjns) on CodePen

Link to comment
Share on other sites

  • 3 weeks later...

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