JMoh JMoh - 4 months ago 8
CSS Question

How to access css3 transform rotate in IE?

Friends,

I am trying to rotate image using css3. On w3schools i found :

-ms-transform: rotate(45deg); // IE 9
-webkit-transform: rotate(45deg); // Safari and Chrome
-moz-transform: rotate(45deg); // Firefox
-o-transform: rotate(45deg); // Opera


So i am dynamically rotating i.e. changing rotational angle using javascript.
So i am able to rotate it Mozilla, Safari, Chrome browser with following code:

document.getElementById("testimg").style.MozTransform = 'rotate('+i+'deg)';
document.getElementById("testimg").style.WebkitTransform = 'rotate('+i+'deg)';


So can somebody tell me how to do this for IE9 & Opera???

Answer

It should be msTransform:

document.getElementById("testimg").style.msTransform = 'rotate('+i+'deg)'; 

http://jsfiddle.net/tEC8W/