Setting a -vendor
prefix that isn't supported in older browsers can cause them to throw an exception with .css
. Instead detect the supported prefix first:
// Start with a fall back
var newCss = { 'zoom' : ui.value };
// Replace with transform, if supported
if('WebkitTransform' in document.body.style)
{
newCss = { '-webkit-transform': 'scale(' + ui.value + ')'};
}
// repeat for supported browsers
else if('transform' in document.body.style)
{
newCss = { 'transform': 'scale(' + ui.value + ')'};
}
// Set the CSS
$('.user-text').css(newCss)
That works in old browsers. I've done scale
here but you could replace it with whatever other transform you wanted.