Applying css3 gradients with jQuery

前端 未结 6 1813
-上瘾入骨i
-上瘾入骨i 2020-12-19 01:01

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(\"bac         


        
6条回答
  •  温柔的废话
    2020-12-19 01:26

    When using .css() in jquery, I believe you have to use the shortened versions of the attributes. For example, margin-left would be marginLeft

    $(element).css("backgroundImage","-webkit-gradient(linear,left bottom,right bottom,color-stop(0.50, rgb(194,231,255)),color-stop(0.50, rgb(255,255,255))");
    

提交回复
热议问题