Reputation: 23181
Could someone show me a simple script that rotates
<img src="xxx.jpg" id="image">
I've read Howto rotate image using jquery rotate plugin?, but I'm still having trouble getting it to work, I've also looked at http://code.google.com/p/jqueryrotate/wiki/Examples#Example_3 but can't seem to find their code...
could someone help me out?
thanks!
Upvotes: 0
Views: 3173
Reputation: 39872
You could try just setting the rotation transform instead of relying on the plugin. This won't cover all browser types, but gets the big, modern browsers.
var angle = 0;
setInterval(function() {
console.log(angle);
$("#image")
.css('-webkit-transform', 'rotate('+angle+'deg)')
.css('-moz-transform', 'rotate('+angle+'deg)')
.css('-ms-transform', 'rotate('+angle+'deg)');
angle++;
}, 100);
Upvotes: 2
Reputation: 8444
The code is right below the example...
var angle = 0;
setInterval(function(){
angle += 3;
$("#img").rotate(angle);
}, 50);
Upvotes: 2