Skip to content

Instantly share code, notes, and snippets.

@williammoreschi
Created October 25, 2012 19:25
Show Gist options
  • Save williammoreschi/3954851 to your computer and use it in GitHub Desktop.
Save williammoreschi/3954851 to your computer and use it in GitHub Desktop.
A CodePen by maciekmp. CSS Heart with js animation - CSS Heart with js animation
<div class='left'>
<div style='padding-right:68px'>
<div></div>
<div></div>
</div>
<div style='padding-right:34px'>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
</div>
<div>
<div></div>
</div>
</div>
<div class='right'>
<div style='padding-left:34px'>
<div></div>
<div></div>
</div>
<div style=''>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
<div></div>
</div>
<div>
<div></div>
<div></div>
</div>
<div>
<div></div>
</div>
</div>
$(document).ready(function(){
$('div>div>div').each(function(id){
$(this).css({
position: 'relative',
top: '-200px',
opacity: 0
});
var wait = Math.floor((Math.random()*3000)+1);
$(this).delay(wait).animate({
top: '0px',
opacity: 1
},1000);
})
});
body{
margin:80px
}
.left,.right{
display:inline-block
}
.left{
width:170px;
height:239px;
margin-right:-4px
}
div>div{
display:block;
height:34px;
}
div>div>div{
width:30px;
height:30px;
background-color:red;
display:inline-block;
float:right;
margin:2px;
}
div.right>div>div{
float:left;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment