nat*_*e75 7 jquery linear-gradients css3
当我在我的页面上使用它时,不会出现背景渐变(我现在只担心Safari和Firefox):
$("#myElement").css({
backgroundImage: "-webkit-gradient(linear, top, bottom, from(black), to(white)",
backgroundImage: "-moz-linear-gradient(top, black, white)"
});
Run Code Online (Sandbox Code Playgroud)
我尝试在适当的浏览器中使用其中一个,但在那里没有运气.
我可以在我的代码中为元素使用内联样式属性,但如果有一种方法可以使用jQuery的API,我宁愿不这样做.
以下适用于我.
$("#myElement").css({
background: "-webkit-gradient(linear, left top, left bottom, from(#000000), to(#FFFFFF))"}).css({
background: "-moz-linear-gradient(top, black, white)"
});
Run Code Online (Sandbox Code Playgroud)
变化:
在Chrome和FF 6上测试过