diff options
author | gnarf <gnarf@gnarf.net> | 2011-03-27 06:30:40 -0500 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-05-01 06:07:57 -0500 |
commit | 40ebb0f846ce4152751d963f9fde0a964eabb337 (patch) | |
tree | 75383ed258451d4a8670e6b2d0de3d5c24447948 /ui/jquery.effects.pulsate.js | |
parent | 4a4d7e4b7392d86944c06e2ec98feef9501f9731 (diff) | |
download | jquery-ui-40ebb0f846ce4152751d963f9fde0a964eabb337.tar.gz jquery-ui-40ebb0f846ce4152751d963f9fde0a964eabb337.zip |
effects.*: Normalizing animation time - 1000 ms effect should only take 1000 ms - Fixes #7067 - Also making sure the queued animations run DIRECTLY after the effect
Diffstat (limited to 'ui/jquery.effects.pulsate.js')
-rw-r--r-- | ui/jquery.effects.pulsate.js | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js index b168b6ef5..3d90d1fa7 100644 --- a/ui/jquery.effects.pulsate.js +++ b/ui/jquery.effects.pulsate.js @@ -16,26 +16,26 @@ $.effects.effect.pulsate = function( o ) { return this.queue( function() { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || 'show' ), - times = ( ( o.times || 5 ) * 2 ) - 1, - duration = o.duration / 2, - isVisible = elem.is( ':visible' ), + + // showing or hiding leave of the "last" time + times = ( ( o.times || 5 ) * 2 ) - ( mode == "show" || mode == "hide" ), + duration = o.duration / times, + show = !elem.is( ":visible" ), animateTo = 0, - i; + i, + queue = elem.queue(), + queuelen = queue.length; - if ( !isVisible ) { + if ( show ) { elem.css('opacity', 0).show(); animateTo = 1; } - if ( ( mode == 'hide' && isVisible ) || ( mode == 'show' && !isVisible ) ) { - times--; - } - - for ( i = 0; i < times; i++ ) { + for ( i = 0; i < times - 1; i++ ) { elem.animate({ opacity: animateTo }, duration, o.easing ); - animateTo = ( animateTo + 1 ) % 2; + animateTo = 1 - animateTo; } elem.animate({ @@ -45,7 +45,13 @@ $.effects.effect.pulsate = function( o ) { elem.hide(); } (o.complete && o.complete.apply(this, arguments)); - }).dequeue(); + }); + + if ( queuelen > 1) { + queue.splice.apply( queue, + [ 1, 0 ].concat( queue.splice( queuelen, times ) ) ); + } + elem.dequeue(); }); }; |