Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-ms-transform for IE9 in JavaScript

How do you set the property of a Div for "-ms-transform" in JavaScript?

I want to rotate a DIV like follows:

-ms-transform: rotate(30deg);

Any help would be great :)

like image 568
williamtroup Avatar asked Dec 16 '11 13:12

williamtroup


2 Answers

Try this:

document.getElementById('myDiv').style.msTransform = 'rotate(30deg)';
like image 160
BoltClock Avatar answered Oct 02 '22 16:10

BoltClock


element.style['transform'] = 'rotate(30deg)';

element.style['msTransform'] = 'rotate(30deg)'; // IE
element.style['MozTransform'] = 'rotate(30deg)'; // Firefox
element.style['WebkitTransform'] = 'rotate(30deg)'; // Chrome
element.style['OTransform'] = 'rotate(30deg)'; // Opera

Here's an example: http://jsfiddle.net/mgWCm/

like image 44
hasser Avatar answered Oct 02 '22 14:10

hasser