Jump to content
Search Community

Animating Elements Loaded Through Javascript

Fakebook test
Moderator Tag

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

I'm having a bit of trouble animating elements that are loaded through JavaScript.

 

Specifically, I was using Jason Mayes Twitter Post Fetcher to load tweets into my page.  However, when I try to animate the username, tweets, or any other elements that it loads, I am unable to.

 

I am sure my timeline and tweens are working properly, because when I add in static elements, they target the proper elements.  Is there anyway to target elements loaded via JS?

See the Pen EPXQOG by anon (@anon) on CodePen

Link to comment
Share on other sites

Hi Fakebook  :)

 

you should to define Tweens after appending ( when the new dom objects is ready ) , seems there's " customCallback " in that config object , and you can use that .

 

See the Pen Ioype by jasonmayes (@jasonmayes) on CodePen

 

Thanks Diaco.  Your idea works, but I was hoping there would be a way to do this without callbacks within plugins.  I wasn't sure if there was something within GSAP or maybe a smarter way to do this with jQuery or JS.

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