Reputation: 17299
I want to rotate an image like with loader animation GIF.
I have <img>
tag in html and my Jquery code is this:
setInterval(
function () {
$('#at_ex1').animate({rotate: '+=10deg'}, 0);
},
200
);
But is not work correctly. How to use this method in Jquery and CSS3 in loop.
Upvotes: 0
Views: 5406
Reputation: 1
var $elie = $("img"), degree = 0, timer;
function rotate() {
$elie.css({ WebkitTransform: 'rotate(' + degree + 'deg)'});
$elie.css({ '-moz-transform': 'rotate(' + degree + 'deg)'});
timer = setTimeout(function() {
++degree; rotate();
},100);
}
Upvotes: 0
Reputation: 491
Check out this fiddle, I suspect it does exactly what you are after.
http://code.google.com/p/jqueryrotate/wiki/Examples
Upvotes: 1