diff options
author | gnarf <gnarf@gnarf.net> | 2011-03-06 17:45:43 -0600 |
---|---|---|
committer | gnarf <gnarf@gnarf.net> | 2011-03-06 17:45:43 -0600 |
commit | 7a60bc6824227bc2613eec1b79bcd6e8170d61f0 (patch) | |
tree | 860fc0e64b76220b114f4fd9c22275624412a42a /ui/jquery.effects.pulsate.js | |
parent | 8ce879e51be564bc9eb906295fd04069ce90a5bc (diff) | |
download | jquery-ui-7a60bc6824227bc2613eec1b79bcd6e8170d61f0.tar.gz jquery-ui-7a60bc6824227bc2613eec1b79bcd6e8170d61f0.zip |
effect.*: Style Guidance
Diffstat (limited to 'ui/jquery.effects.pulsate.js')
-rw-r--r-- | ui/jquery.effects.pulsate.js | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js index e7d53d02d..c5f67b12b 100644 --- a/ui/jquery.effects.pulsate.js +++ b/ui/jquery.effects.pulsate.js @@ -12,39 +12,40 @@ */ (function( $, undefined ) { -$.effects.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 ? o.duration / 2 : $.fx.speeds._default / 2, - isVisible = elem.is(':visible'), - animateTo = 0; +$.effects.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' ), + animateTo = 0, + i; - if (!isVisible) { + if ( !isVisible ) { elem.css('opacity', 0).show(); animateTo = 1; } - if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) { + if ( ( mode == 'hide' && isVisible ) || ( mode == 'show' && !isVisible ) ) { times--; } - for (var i = 0; i < times; i++) { - elem.animate({ opacity: animateTo }, duration, o.easing); - animateTo = (animateTo + 1) % 2; + for ( i = 0; i < times; i++ ) { + elem.animate({ + opacity: animateTo + }, duration, o.easing ); + animateTo = ( animateTo + 1 ) % 2; } - elem.animate({ opacity: animateTo }, duration, o.easing, function() { + elem.animate({ + opacity: animateTo + }, duration, o.easing, function() { if (animateTo == 0) { elem.hide(); } (o.complete && o.complete.apply(this, arguments)); - }); - - elem - .queue('fx', function() { elem.dequeue(); }) - .dequeue(); + }).dequeue(); }); }; |