Tuesday, December 18, 2012

jquery/javascript: looping an animation function with different ID tags one after each other?

Hi I have a function that I want to loop around using a different ID tag each time. This function is called when the navigation link is clicked. So far I have this and I would like to change txt1 to txt2 then txt 3 and up to txt5 thus playing each animation one after each other. Thanks!



function animetxt(){
$o=$(\"#txt1\");
$o.html($o.text().replace(/([\\S])/g,\'<span>$1</span>\'));
$o.css(\'display\',\'inline-block\');
$(\'span\',$o).stop().css({position:\'relative\',
display:\'inline-block\',
opacity:0,
fontSize:84,
top:function(i){return Math.floor(Math.random()*500)*((i%2)?1:-1);},
left:function(i){return Math.floor(Math.random()*500)*((i%2)?1:-1);}
}).animate({opacity:1,fontSize:20,top:0,left:0},1000);}






Rating: 3 out of 5 based on 3 ratings



The post jquery/javascript: looping an animation function with different ID tags one after each other? appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/jqueryjavascript-looping-an-animation-function-with-different-id-tags-one-after-each-other.html

No comments:

Post a Comment