JSFiddle - React, Tailwind, and code Playground
by alnitak
HTML
<div id="test" class="c1"> Test </div>
CSS
.c1 {
background: #ff0000;
}
.c2 {
background: #00ff00;
}
JavaScript
(function($) {
$.fn.queued = function() {
var self = this;
var func = arguments[0];
var args = [].slice.call(arguments, 1);
return this.queue(function() {
$.fn[func].apply(self, args).dequeue();
});
}
}(jQuery));
$('#test')
.delay(1000)
.queued("removeClass", "c1")
.delay(1000)
.queued("addClass", "c2");