Skip to content Skip to sidebar Skip to footer

Bug With .animate()'s Callback?

I'm trying to make some div to animate, then in the callback, call another function. Nothing hard. Here's the code: function transfertMenu(){ var chosenOption = this.firstChild

Solution 1:

You should remove () from callback function because otherwise it gets called immediately:

 $('#leftMenucontent').animate({
    left:'0px'
 }, 500, constructMenu());
------problem --------^

Should be:

 $('#leftMenucontent').animate({
    left:'0px'
 }, 500, constructMenu);

So specify your callback function as constructMenu instead of constructMenu()


Post a Comment for "Bug With .animate()'s Callback?"