I want to add a class, wait 2 seconds and add another class.
.addClass(\"load\").wait(2sec).addClass(\"done\");
Is there any way?
There is an function, but it's extra: http://docs.jquery.com/Cookbook/wait
This little snippet allows you to wait:
$.fn.wait = function(time, type) {
time = time || 1000;
type = type || "fx";
return this.queue(type, function() {
var self = this;
setTimeout(function() {
$(self).dequeue();
}, time);
});
};