JSFiddle - React, Tailwind, and code Playground
by Hashem Qolami
HTML
<div id="parent">
<div class="start">
</div>
</div>
<input type="button" value="1- Remove Elements" id="remove"/>
<input type="button" value="2- Generate" id="generate" />
CSS
#parent {
border: solid 1px black;
}
.start {
width: 50px;
height: 50px;
background: blue;
-webkit-transition: background 4s;
-moz-transition: background 4s;
transition: background 4s;
}
.end {
background: red;
}
JavaScript
var clone = "";
$(window).load(function(){
clone = $("#parent").children("div").clone();
$("#parent").children("div").addClass("end");
});
$("#remove").click(function(){
$("#parent").children("div").remove();
clone.removeClass('end');
});
$("#generate").click(function() {
$("#parent").append(clone);
$("#parent").children("div").delay(500).queue(function() {
$(this).addClass("end").dequeue();
});
});