I want to add a class, wait 2 seconds and add another class.
.addClass(\"load\").wait(2sec).addClass(\"done\");
Is there any way?
delay() will not do the job. The problem with delay() is it's part of the animation system, and only applies to animation queues.
What if you want to wait before executing something outside of animation??
Use this:
window.setTimeout(function(){
// do whatever you want to do
}, 600);
What happens?: In this scenario it waits 600 miliseconds before executing the code specified within the curly braces.
This helped me a great deal once I figured it out and hope it will help you as well!
IMPORTANT NOTICE: 'window.setTimeout' happens asynchronously. Keep that in mind when writing your code!