< Retour au menu
Code HTML
Sélectionner le code
<div class="random_moving"> <img class="plume" src="images/plume.png" alt="" /> </div>
Code JS
Sélectionner le code
// Random moving if( $('.random_moving').size() !=0 ) { $('.plume').css('position','absolute').css('top',0).css('left',500).css('margin','0 0 0 -60px'); function bougePlume() { $('.plume').animate( { top:parseInt($('.plume').css('top'))+Math.round(Math.random()*10+5), left: parseInt($('.plume').css('left'))+Math.round(Math.random()*10)-Math.round(Math.random()*10) }, 500, function(){ bougePlume(); } ); } bougePlume(); }