Jump to content
Search Community

Get Timeline to "re-recognize" elements when DOM is updated

DRACO test
Moderator Tag

Go to solution Solved by Dipscom,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi,

I've been using the TimelineMax library to animate navigation tabs that are loaded via AJAX. The problem that I am facing is that elements that are newly added to the DOM aren't animated, as they haven't been detected when the Timeline was created.

Playing the timeline from the start has no effect especially .from() animations

The linked codepen demonstrates my problem although I have replaced the AJAX call with a html load function.

 

Thanks in advance

See the Pen eJjyON by ahmedkhatib (@ahmedkhatib) on CodePen

Link to comment
Share on other sites

Hi DRACO,

 

Is there any particular reason why you simply don't wait to create the timeline after your loading is finished?

 

Something along these lines:

 

See the Pen obMqjX?editors=0010 by dipscom (@dipscom) on CodePen

Well there are plenty of tweens to be added after the load. But I guess I could use the addLabel() method and insert tweens at appropriate places. Wow, didn't think of this:).

Thanks Dipscom!

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