hi I want to set the background-image for all browser with jquery :
background-image:linear-gradient(green, blue); /* Norme W3C */
background-image:-moz-linear-gradient(green, blue); /* Firefox */
background-image:-webkit-gradient(linear, green, blue); /* Chrome, Safari */
background-image:-o-linear-gradient(green, blue); /* Opera */
background-image:-ms-linear-gradient(green, blue); /* IE */
and I set it like that :
$("#"+elmt).css("background-image" , "linear-gradient("+hex+","+$('#test2').val()+")" );
only for W3C but it work on firefox but not on Chrome.
How can I set all this setting?
From the jQuery 1.8 Blog’s release
Automatic CSS prefixing: When you use a CSS property, in either .css() or .animate(), we’ll use the correct prefixed property (when appropriate) for that browser. For example, take .css(“user-select”, “none”); in Chrome/Safari we’ll set the value as “-webkit-user-select”, Firefox will use “-moz-user-select”, and IE10 will use “-ms-user-select”.
Upgrade to the latest version and this should be handled automatically.
Edit
This should work automatically, the following should be implemented in jQuery 1.8,
The usage
Which came from the link — a working jsFiddle
So one of these two methods should work for you.