source: trunk/template-common/lib/ui/effects.pulsate.js @ 3282

Last change on this file since 3282 was 3282, checked in by plg, 15 years ago

change: according to topic:15067, svn:keywords property was removed

  • Property svn:eol-style set to LF
File size: 1.4 KB
Line 
1/*
2 * jQuery UI Effects Pulsate
3 *
4 * Copyright (c) 2008 Aaron Eisenberger (aaronchi@gmail.com)
5 * Dual licensed under the MIT (MIT-LICENSE.txt)
6 * and GPL (GPL-LICENSE.txt) licenses.
7 *
8 * http://docs.jquery.com/UI/Effects/Pulsate
9 *
10 * Depends:
11 *      effects.core.js
12 */
13(function($) {
14
15$.effects.pulsate = function(o) {
16
17        return this.queue(function() {
18               
19                // Create element
20                var el = $(this);
21               
22                // Set options
23                var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
24                var times = o.options.times || 5; // Default # of times
25               
26                // Adjust
27                if (mode == 'hide') times--;
28                if (el.is(':hidden')) { // Show fadeIn
29                        el.css('opacity', 0);
30                        el.show(); // Show
31                        el.animate({opacity: 1}, o.duration / 2, o.options.easing);
32                        times = times-2;
33                }
34               
35                // Animate
36                for (var i = 0; i < times; i++) { // Pulsate
37                        el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);
38                };
39                if (mode == 'hide') { // Last Pulse
40                        el.animate({opacity: 0}, o.duration / 2, o.options.easing, function(){
41                                el.hide(); // Hide
42                                if(o.callback) o.callback.apply(this, arguments); // Callback
43                        });
44                } else {
45                        el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing, function(){
46                                if(o.callback) o.callback.apply(this, arguments); // Callback
47                        });
48                };
49                el.queue('fx', function() { el.dequeue(); });
50                el.dequeue();
51        });
52       
53};
54
55})(jQuery);
Note: See TracBrowser for help on using the repository browser.