[SPIP] +spip v3.0.17
[lhc/web/clavette_www.git] / www / prive / javascript / pause.js
1 /*
2 * Jonathan Howard
3 *
4 * jQuery Pause
5 * version 0.2
6 *
7 * Requires: jQuery 1.0 (tested with svn as of 7/20/2006)
8 *
9 * Feel free to do whatever you'd like with this, just please give credit where
10 * credit is do.
11 *
12 *
13 *
14 * pause() will hold everything in the queue for a given number of milliseconds,
15 * or 1000 milliseconds if none is given.
16 *
17 *
18 *
19 * unpause() will clear the queue of everything of a given type, or 'fx' if no
20 * type is given.
21 */
22
23 $.fn.pause = function(milli,type) {
24 milli = milli || 1000;
25 type = type || "fx";
26 return this.queue(type,function(){
27 var self = this;
28 setTimeout(function(){
29 $.dequeue(self);
30 },milli);
31 });
32 };
33
34 $.fn.clearQueue = $.fn.unpause = function(type) {
35 return this.each(function(){
36 type = type || "fx";
37 if(this.queue && this.queue[type]) {
38 this.queue[type].length = 0;
39 }
40 });
41 };