// Question // How can I animate and rotation this code?
by Alexander Lashchevsky
HTML
<div class="block-1"></div>
<div class="block-2"></div>
<div class="block-3"></div>
CSS
.block-1 {background: red; transition: height .5s linear;}
.block-1.active {height: 100px;}
.block-2 {background: green; transition: height .5s linear;}
.block-2.active {height: 100px;}
.block-3 {background: blue; transition: height .5s linear;}
.block-3.active {height: 100px;}
JavaScript
setInterval(function() {
$('.block-1').addClass('active');
setTimeout(function() {
$('.block-2').addClass('active');
setTimeout(function() {
$('.block-3').addClass('active');
setTimeout(function() {
$('.block-1, .block-2, .block-3').removeClass('active');
}, 500);
}, 400);
}, 500);
}, 1400);