JSFiddle - React, Tailwind, and code Playground
by Silvestrs Kante
HTML
<div class="box" id="test"></div>
<button class="switchBox1">BOX 1</button>
<button class="switchBox">BOX</button>
CSS
.box {
background-color: blue;
}
.box2 {
background-color: red;
}
div{
width: 200px;
height: 200px;
}
JavaScript
$(".switchBox1").click(function(){
$("#test").switchClass("box","box2",{
duration: 1000,
queue: false
});
});
$(".switchBox").click(function(){
$("#test").switchClass("box2","box",{
duration: 1000,
queue: false
});
});