Forxs
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by Forxs
-
-
If I use call() the browser returns the error "Cannot tween a null target."
-
So 'element' is just a jQuery DOM object. insertContent just pulls some information from that element and injects it into another element:
function insertContent(element){ var infoContent = '<div class="image">'; infoContent += element.find('.headshot_alternate').html(); infoContent += '</div>'; infoContent += '<div class="name">'+element.find('.info .name').html()+'</div>'; infoContent += '<div class="position">'+element.find('.info .position').html()+'</div>'; infoContent += '<div class="bio">'+element.find('.info .bio').html()+'</div>'; $('.info-row .content').html(''); $('.info-row .content').html(infoContent); }
So the variable infoContent is just building the new content for the container. Then it injects it into '.info-row .content'.
-
I have this function:
function changeInfo(element){ new TimelineMax(); tl = new TimelineMax(); tl.to('.info-row .content', 0.3, {opacity: 0}, 0) .add(insertContent(element)) .to('.info-row .content', 0.3, {opacity: 1}, 0.6) //insertContent(element); }
Which is fading out some content, run a function to insert the new content, and then fade in the new content.
The browser is returning "Uncaught Cannot add undefined into the timeline; it is not a tween, timeline, function, or string."
If I comment out the timeline and just run insertContent(element); it works fine (all be it without the animation obviously).
Any idea what I can do to fix this?
Cheers,
Callback using .add is returning undefined
in GSAP
Posted
This sorted it, thank you!