aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.js
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-04 12:06:47 -0500
committerjeresig <jeresig@gmail.com>2009-12-04 12:06:47 -0500
commitbbd933cbfe6d31a749cb336d7a84155ccfab247f (patch)
tree9b208f5dd7be76949384555ee3c86fd2d1b033fd /src/data.js
parentd42afd0f657d12d6daba6894d40226bea83fe1b6 (diff)
downloadjquery-bbd933cbfe6d31a749cb336d7a84155ccfab247f.tar.gz
jquery-bbd933cbfe6d31a749cb336d7a84155ccfab247f.zip
Added in the .delay() method for delaying the execution of queued functions and animations.
Diffstat (limited to 'src/data.js')
-rw-r--r--src/data.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/data.js b/src/data.js
index 079cf99d5..3e6eb19f6 100644
--- a/src/data.js
+++ b/src/data.js
@@ -166,6 +166,21 @@ jQuery.fn.extend({
jQuery.dequeue( this, type );
});
},
+
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function() {
+ var elem = this;
+ setTimeout(function() {
+ jQuery.dequeue( elem, type );
+ }, time );
+ });
+ },
+
clearQueue: function(type){
return this.queue( type || "fx", [] );
}