aboutsummaryrefslogtreecommitdiffstats
path: root/ui/source/effects.pulsate.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-05-23 09:26:18 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-05-23 09:26:18 +0000
commitab281b36d7cc10913a77f2f8da9ff7b7c011b3ee (patch)
treee75c648d2ee6a4fb467a2f1a2d092e1544a938a5 /ui/source/effects.pulsate.js
parent489160abd896aac7c140775207d18a3bf489c08f (diff)
downloadjquery-ui-ab281b36d7cc10913a77f2f8da9ff7b7c011b3ee.tar.gz
jquery-ui-ab281b36d7cc10913a77f2f8da9ff7b7c011b3ee.zip
Diffstat (limited to 'ui/source/effects.pulsate.js')
-rw-r--r--ui/source/effects.pulsate.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/ui/source/effects.pulsate.js b/ui/source/effects.pulsate.js
new file mode 100644
index 000000000..aee1525ff
--- /dev/null
+++ b/ui/source/effects.pulsate.js
@@ -0,0 +1,43 @@
+;(function($) {
+
+ $.effects.pulsate = function(o) {
+
+ return this.queue(function() {
+
+ // Create element
+ var el = $(this);
+
+ // Set options
+ var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
+ var times = o.options.times || 5; // Default # of times
+
+ // Adjust
+ if (mode != 'hide') times--;
+ if (el.is(':hidden')) { // Show fadeIn
+ el.css('opacity', 0);
+ el.show(); // Show
+ el.animate({opacity: 1}, o.duration / 2, o.options.easing);
+ times--;
+ }
+
+ // Animate
+ for (var i = 0; i < times; i++) { // Pulsate
+ el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);
+ };
+ if (mode == 'hide') { // Last Pulse
+ el.animate({opacity: 0}, o.duration / 2, o.options.easing, function(){
+ el.hide(); // Hide
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ });
+ } else {
+ el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing, function(){
+ if(o.callback) o.callback.apply(this, arguments); // Callback
+ });
+ };
+ el.queue('fx', function() { el.dequeue(); });
+ el.dequeue();
+ });
+
+ };
+
+})(jQuery); \ No newline at end of file