diff options
author | gnarf <gnarf@gnarf.net> | 2011-05-10 16:25:08 -0500 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-05-10 16:25:08 -0500 |
commit | 783f134aaa333b9e8795c701d8fd741de387cb0e (patch) | |
tree | 9a944fb8d22c6e8bf9cddf37be3191c59c7c45a4 /ui/jquery.effects.bounce.js | |
parent | 27a7deebf299e1673e8b452476be02e486bba2c6 (diff) | |
download | jquery-ui-783f134aaa333b9e8795c701d8fd741de387cb0e.tar.gz jquery-ui-783f134aaa333b9e8795c701d8fd741de387cb0e.zip |
effects: Updating bounce/pulsate/shake to fire callbacks before the next anim starts
Diffstat (limited to 'ui/jquery.effects.bounce.js')
-rw-r--r-- | ui/jquery.effects.bounce.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js index bb386a4f4..9e1117ce9 100644 --- a/ui/jquery.effects.bounce.js +++ b/ui/jquery.effects.bounce.js @@ -79,10 +79,8 @@ $.effects.effect.bounce = function(o) { upAnim = {}; upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; - // add the finish callback to the last animation if we aren't hiding el.animate( upAnim, speed, easing ) - .animate( downAnim, speed, easing, - ( ( i === times - 1 ) && !hide ) ? finish : undefined ); + .animate( downAnim, speed, easing ); distance = hide ? distance * 2 : distance / 2; } @@ -92,24 +90,25 @@ $.effects.effect.bounce = function(o) { upAnim = { opacity: 0 }; upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; - el.animate( upAnim, speed, easing, function(){ - el.hide(); - finish(); - }); + el.animate( upAnim, speed, easing ); } - - function finish() { + + el.queue( function( next ) { + if ( hide ) { + el.hide(); + } $.effects.restore( el, props ); $.effects.removeWrapper( el ); if ( o.complete ) { o.complete.apply( el[ 0 ] ); } - } + next(); + }); // inject all the animations we just queued to be first in line (after "inprogress") if ( queuelen > 1) { queue.splice.apply( queue, - [ 1, 0 ].concat( queue.splice( queuelen, anims ) ) ); + [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); } next(); |