aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.effects.pulsate.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.effects.pulsate.js')
-rw-r--r--ui/jquery.effects.pulsate.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js
index 3325c251f..a0ddf51fd 100644
--- a/ui/jquery.effects.pulsate.js
+++ b/ui/jquery.effects.pulsate.js
@@ -15,11 +15,12 @@
$.effects.effect.pulsate = function( o ) {
return this.queue( function( next ) {
var elem = $( this ),
- mode = $.effects.setMode( elem, o.mode || "effect" ),
- show = mode === "show" || elem.is( ":hidden" ),
+ mode = $.effects.setMode( elem, o.mode || "show" ),
+ show = mode === "show",
+ hide = mode === "hide",
showhide = ( show || mode === "hide" ),
- // showing or hiding adds an extra "half" animation
+ // showing or hiding leaves of the "last" animation
anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
duration = o.duration / anims,
animateTo = 0,
@@ -27,7 +28,7 @@ $.effects.effect.pulsate = function( o ) {
queuelen = queue.length,
i;
- if ( show ) {
+ if ( show || !elem.is(':visible')) {
elem.css( "opacity", 0 ).show();
animateTo = 1;
}
@@ -42,19 +43,22 @@ $.effects.effect.pulsate = function( o ) {
elem.animate({
opacity: animateTo
- }, duration, o.easing, function() {
- if ( animateTo === 0 ) {
+ }, duration, o.easing);
+
+ elem.queue( function( next ) {
+ if ( hide ) {
elem.hide();
}
if ( o.complete ) {
o.complete.apply( this );
}
+ next();
});
// We just queued up "anims" animations, we need to put them next in the queue
if ( queuelen > 1) {
queue.splice.apply( queue,
- [ 1, 0 ].concat( queue.splice( queuelen, anims ) ) );
+ [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
}
next();
});