jquery each to loop and animate
Posted
by
medk
on Stack Overflow
See other posts from Stack Overflow
or by medk
Published on 2012-11-07T22:56:30Z
Indexed on
2012/11/07
22:59 UTC
Read the original article
Hit count: 147
jQuery
|jquery-each
I have some span tags:
<span w="560"></span>
<span w="340"></span>
<span w="120"></span>
With jQuery, I want to select EACH span, get the value inside its w attribute and animate it to that value + "px".
I have a simple code that didn't work:
$(document).ready(function(){
$('span').animate({width: $(this).attr('w') + 'px'}, 2000);
});
Any Suggestions?
Thanks.
© Stack Overflow or respective owner