Eventually, I wish to dynamically alter gradients based on different things, but how do I get jquery to apply a css3 gradient?
//works
$(element).css("background-image", "url(http://www.google.co.uk/images/logos/ps_logo2.png)");
//doesn't work
$(element).css("background-image","-webkit-gradient(linear,left bottom,right bottom,color-stop(0.50, rgb(194,231,255)),color-stop(0.50, rgb(255,255,255))");
//doesn't work
$(element).css("background-image","-moz-linear-gradient(left center,rgb(194,231,255) 28%,rgb(255,255,255) 28%");
What am I missing? I've also tried
$(element).css({background: "-webkit-gradient(linear,left bottom,right bottom,color-stop(0.50, rgb(194,231,255)),color-stop(0.50, rgb(255,255,255)"});
Are these approaches not valid?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…