Added in the .delay() method for delaying the execution of queued functions and animations.
This commit is contained in:
parent
d42afd0f65
commit
bbd933cbfe
2 changed files with 30 additions and 0 deletions
15
src/data.js
15
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", [] );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue