Skip to content Skip to sidebar Skip to footer

Elegantly Animate A Stack Of Divs

I am trying to achieve a nice animation, however I am a bit stuck using CSS only to achieve the effect that I want. Currently I am using animate.css to animate new elements in, but

Solution 1:

fiddle

In order to make this work I did a couple of things:-

1 CSS

.child {
 width: 40px;
 height: 40px;
 display: block; //inline block results in jerkiness when inserting items margin:2px; //added margin to compensate for inline-block becoming block.border: 1px solid #AAAAAA;
 }

2 JS

setTimeout(function(){
    var newbox = "<div class='child  animated bounceInDown'></div>"
    $(newbox).prependTo('.container').hide().slideDown(500);//notice that I prepend to the container, then hide the 'newbox' and then slide it down -> this gives the desired effect.

}, 2000);

Hopefully that helps.

Post a Comment for "Elegantly Animate A Stack Of Divs"