Float
by AaronLayton
HTML
<div class="poem"></div>
CSS
div {
background:#ddd;
height:100px;
left:50%;
margin:-50px 0 0 -50px;
position:absolute;
top:250px;
width:100px;
}
JavaScript
var poemSpeed = 3000;
var moveBy = 10;
function movePoem(){
// First animate up and then down
$('.poem').animate({ top: '-=' + moveBy }, (poemSpeed/2),'swing').animate({ top: '+=' + moveBy }, (poemSpeed/2),'swing');
}
var floatAnimation = setInterval('movePoem()', poemSpeed );