jquery - Extract inner content from a string -


here problem facing - having div called ('mydiv'). , have set setinterval function, runs every 2second. want each time when setinterval execute, want rotate div '15deg' extra.

i did almost. when doing string manipulation, getting wrong. //here code.

//css transform required value = 15ddeg not '15deg' how extract '15deg' 15deg (without qoute)

<!doctype html> <html> <head> <script src="http://code.jquery.com/jquery-git2.js"></script> <meta charset=utf-8 /> <script>        $(function(){         var foo = setinterval('animatediv()', 2000);     var count = 15;      function animatediv(){        //console.log(count);      count += 10;         $('.mydiv').css({'-webkit-transform':'rotate(count + "deg")'});        //console.log(count + "deg");     }       });  </script>  <title>js bin</title> </head> <body>   <div class='mydiv'></div> </body> </html> 

http://jsfiddle.net/rwqsc/

(function(){         var intid = setinterval(animatediv, 2000),             count = 15,             $mydiv = $('.mydiv'); //cache div don't keep looking though dom same element.       function animatediv(){        console.log(count);        count += 10;        $mydiv.css({'-webkit-transform':'rotate(' + count +'deg)'});        //console.log(count + "deg");     }  }()); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -