JSFiddle - React, Tailwind, and code Playground
HTML
<!-- expected -->
<div id="control" class="blue box"></div>
<!-- unexpected -->
<div id="example" class="blue box"></div>
CSS
.box {
height: 100px;
margin: 0 0 10px;
width: 100px;
}
.red {
background-color: #f00;
}
.green {
background-color: #0f0;
}
.blue {
background-color: #00f;
}
JavaScript
// expected
$('#control').delay(2000)
.animate({ backgroundColor: '#f00' }, 1000)
.delay(1000)
.animate({ backgroundColor: '#0f0' }, 1000)
.delay(1000)
.animate({ backgroundColor: '#00f' }, 1000);
// unexpected
$('#example').delay(2000)
.switchClass('blue', 'red', 1000)
.delay(1000)
.switchClass('red', 'green', 1000)
.delay(1000)
.switchClass('green', 'blue', 1000);