X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fprive%2Fjavascript%2Fpause.js;fp=www%2Fprive%2Fjavascript%2Fpause.js;h=f981137cad44796ccc2cdb61c864c3ae452377d4;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/prive/javascript/pause.js b/www/prive/javascript/pause.js new file mode 100644 index 0000000..f981137 --- /dev/null +++ b/www/prive/javascript/pause.js @@ -0,0 +1,41 @@ +/* + * Jonathan Howard + * + * jQuery Pause + * version 0.2 + * + * Requires: jQuery 1.0 (tested with svn as of 7/20/2006) + * + * Feel free to do whatever you'd like with this, just please give credit where + * credit is do. + * + * + * + * pause() will hold everything in the queue for a given number of milliseconds, + * or 1000 milliseconds if none is given. + * + * + * + * unpause() will clear the queue of everything of a given type, or 'fx' if no + * type is given. + */ + +$.fn.pause = function(milli,type) { + milli = milli || 1000; + type = type || "fx"; + return this.queue(type,function(){ + var self = this; + setTimeout(function(){ + $.dequeue(self); + },milli); + }); +}; + +$.fn.clearQueue = $.fn.unpause = function(type) { + return this.each(function(){ + type = type || "fx"; + if(this.queue && this.queue[type]) { + this.queue[type].length = 0; + } + }); +}; \ No newline at end of file