Daniel J F
Daniel J F

Reputation: 1064

How to work with multiple CSS properties?

Is it possible to work with CSS properties?

For instance:

-webkit-transform: scaleX(-1) scaleY(-1)

Can I easily remove scaleX(-1) or add something new, without rewriting the whole -webkit-transform or changing classes?

Upvotes: 2

Views: 1273

Answers (1)

picardo
picardo

Reputation: 24886

That css property takes two arguments. Therefore you cannot change one without touching the other. But this should be all you need to do:

$("#your-element").css("-webkit-transform","scaleX(-1) scaleY(-1)");

Edit

   function changeTransform(el, x,y){
     var val = x + " " + y;
     $(el).css({"-webkit-transform":val, "-moz-transform": val, "-webkit-transform": val, "-o-transform": val});
  }

Upvotes: 1

Related Questions