jquery deffered with a random number of animations -
I found x the number of animations that run on a random timer. I also have a code that needs to be run after all the animation is completed. I had thought of using deferred, but it does not seem that the way I thought it was going on. There is a link here (you may need to run it for a while to work): Code: Any suggestions about waiting for a callback once all animation is complete? You are always overriding the Add them to an array and Reference:
var callback = Function () {Warning ('done!'); }; Var Animation; (Var i = 0; i & lt; $ ('div'). Length; i ++) {var random = Math.random () * (800 - 100) + 100; Animation = $ ('div'). Eq (i) .slideUp (random); } $ When (animation) .done (callback);
animation variable. So the object you
$ Send in will be one of the last repetition.
$ When calling from that array:
var animation = []; (Var i = 0; i & lt; $ ('div'). Length; i ++) {var random = Math.random () * (800 - 100) + 100; Animations.push (. $ ('Div') eq (i) .slideUp (random)); } $ when. Apple ($, animation). Don (callback);
Comments
Post a Comment