Reputation: 212
I want to add a transform to a specific element. I have some code that will append the correct prefect depending of the browser.
In chrome it works fine, but it firefox it doesn't work. when i do style['transform'] = "..." it works but when i do style['-moz-transform'] it doesn"t work.
So how do you use prefixes in firefox?
Upvotes: 0
Views: 346
Reputation: 66490
the property names are: WebkitTransform, MozTransform, msTransform and OTransform
.
You can check which property to use with this code:
function getTransformProperty(element) {
var properties = ['transform', 'WebkitTransform',
'MozTransform', 'msTransform',
'OTransform'];
var p;
while (p = properties.shift()) {
if (element.style[p] !== undefined) {
return p;
}
}
return false;
}
Upvotes: 1