javascript - dojo: Perform function after animation is complete -
i'm trying chain animation , function together, when user clicks on button animation plays, and, when it's finished, function performed.
in particular, i'm trying allow user pin menu in place or unpin floats down page them. control whether menu pinned or unpinned toggling class 'pinned' when click button. want animation play make transition smooth (like menu fading out or sliding it's new position), , toggle class.
unfortunately, class toggling before animation finished, making menu jump switches between two.
is there way of delaying toggle class until animation done?
the animation has end event can listen on.
http://dojotoolkit.org/reference-guide/1.9/dojo/fx/chain.html http://dojotoolkit.org/documentation/tutorials/1.7/animation/
require(["dojo/fx", "dojo/on"], function(corefx, on){ var anima = ... var animb = ... var chain = corefx.chain([anima, animb]); on(chain, "end", function(){ // set css }); chain.play(); });
Comments
Post a Comment