2 * jQuery UI Effects Pulsate 1.7.1
4 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT (MIT-LICENSE.txt)
6 * and GPL (GPL-LICENSE.txt) licenses.
8 * http://docs.jquery.com/UI/Effects/Pulsate
15 $.effects.pulsate = function(o) {
17 return this.queue(function() {
23 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
24 var times = o.options.times || 5; // Default # of times
25 var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
28 if (mode == 'hide') times--;
29 if (el.is(':hidden')) { // Show fadeIn
32 el.animate({opacity: 1}, duration, o.options.easing);
37 for (var i = 0; i < times; i++) { // Pulsate
38 el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing);
40 if (mode == 'hide') { // Last Pulse
41 el.animate({opacity: 0}, duration, o.options.easing, function(){
43 if(o.callback) o.callback.apply(this, arguments); // Callback
46 el.animate({opacity: 0}, duration, o.options.easing).animate({opacity: 1}, duration, o.options.easing, function(){
47 if(o.callback) o.callback.apply(this, arguments); // Callback
50 el.queue('fx', function() { el.dequeue(); });