Reputation: 729
Is it possible to temporarily add a class to an element and then remove it again after xx milliseconds?
For example;
When I click on an element with the class .trigger
can I add a class of .loading
to another element with a class of .menu
and then, after say 500ms, remove the .loading
class again?
Upvotes: 0
Views: 2781
Reputation: 2596
You can do this with a setTimeout like this :
$("MyControl").addClass("loading");
setTimeout(function () {
$("MyControl").removeClass("loading");
},500);
Upvotes: 4