I can't seem to get mine to work. Here's my code:
(Note: I have other buttons not shown in code that play the timeline after every scene.)
var tl = new TimelineMax({paused:true});
tl.add("scene01")
.from(".bg1", .5, {left:"+=10%", autoAlpha:0}, "scene01")
.add(insertBG("01.png",".testcard"), "scene01")
.add("scene02").addPause()
.to(".bg1", .5, {autoAlpha:0}, "scene02")
.from(".bg2", .5, {left:"+=10%", autoAlpha:0}, "scene02");
function insertBG(bgName, cardName) {
$(cardName).css('background-image', 'url(images/'+ bgName +')');
}
It throws the following error at the .add(insertBG()) call :
"Cannot add undefined into the timeline; it is not a tween, timeline, function, or string."
The insertBG() function works fine when called directly outside the timeline... What am I doing wrong? Thanks!