Jump to content
Search Community

Adding data-lag onComplete ?

darkgr33n test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi,

 

I have three columns that use stagger to animate into position using ScrollTrigger.batch. This is set to Once only.

I'd like to add a data-lag attribute to the columns, but if I add it in the code, it competes with the stagger animation resulting in a bit of a twitch.

 

The question is, once the animation is completed, is there a way to add the data-lag attribute to the columns so that we can then use the goodness of SmoothScroller but not have it affect the animation ?

 

Thanks! 

See the Pen bGQEoMz by darkgr33n (@darkgr33n) on CodePen

Link to comment
Share on other sites

  • Solution

Yeah, that's because you're creating conflicting animations - both the data-lag AND you independent animation are trying to control the same property ("y"). You could just make your independent animation use yPercent instead -OR- you could dynamically add the lag effect in the onComplete of your animation (so it waits to apply it) using the effects() method. Personally, I favor option #1. 

  • Like 2
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...