Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you tweak "-webkit-" prefixed CSS properties in jQuery?

Tags:

jquery

css

$(this).css({     -webkit-transform:'rotate(180deg)',     -moz-transform: 'rotate(180deg)',     -o-transform: 'rotate(180deg)',     -ms-transform: 'rotate(180deg)' }); 

This is throwing the error:

Uncaught SyntaxError: Unexpected token -

I'm really hoping I don't have to install the jQuery Rotation plugin just for this one instance.

like image 670
RGBK Avatar asked Oct 28 '11 23:10

RGBK


People also ask

Can we change CSS properties values using jQuery?

You can use the css method to change a CSS property (or multiple properties if necessary): $("#business"). click(function(event){ jQuery. fx.

What is WebKit in CSS?

The term 'webkit' is used in the CSS syntax for rendering content in Safari and Chrome browsers. Webkit code may need to be added in CSS to ensure it renders correctly on Chrome and Safari due to the lack of cross-compatibility.

Which jQuery method is used to get or set a CSS property value?

The jQuery css() method is used to get the computed value of a CSS property or set one or more CSS properties for the selected elements.

What are WebKit CSS extensions?

WebKit extensions are proprietary CSS properties that are designed to work on browsers that are powered by the WebKit browser engine, such as Apple Safari and Google Chrome. WebKit is an open source framework.


2 Answers

$(this).css({     '-webkit-transform':'rotate(180deg)',     '-moz-transform': 'rotate(180deg)',     '-o-transform': 'rotate(180deg)',     '-ms-transform': 'rotate(180deg)' }); 
like image 177
Justin808 Avatar answered Sep 24 '22 22:09

Justin808


Quote them:

$(this).css({     '-webkit-transform': 'rotate(180deg)',     '-moz-transform':    'rotate(180deg)',     '-o-transform':      'rotate(180deg)',     '-ms-transform':     'rotate(180deg)' }); 
like image 26
Ry- Avatar answered Sep 21 '22 22:09

Ry-