I have a variable called value in my js that gets updated based on the scrollbars percent. my value is between 0 – 360. I want a way to update the below css values. Is there a way I can group them together in an object and pass the value to them. For example when using opacity I can do something like this.
function updateCSS(target, value){
var cssObj = {};
cssObj["opacity"] = value;
target.css(cssObj);
}
I need a way to be able to update all the prefix rotate property with my value number. Any good ideas how I could do this.
-webkit-transform: rotate(value); /* Safari 3.1+, Chrome
-moz-transform: rotate(value); /* Firefox 3.5-15
-ms-transform: rotate(value); /* IE9+
-o-transform: rotate(value); /* Opera 10.5-12.00
transform: rotate(value); /* Firefox 16+, Opera 12.50+
Just use the
.css()method, and also you forgot to includedeg:Fiddle:
http://jsfiddle.net/XKyEz/3/