【发布时间】:2014-05-23 09:21:31
【问题描述】:
EXAMPLE
我正在尝试将元素的背景设置为渐变,但它没有设置。它将style="" 添加到标记中,当我将代码直接放入firebug(我使用的是Firefox)时它可以工作。知道为什么它不工作或如何让它工作吗?
$('main > article').each(function (index) {
var bg = $(this).css('background-color');
var nextbg = $(this).next().css('background-color');
if ($(this).next().length && nextbg != bg) {
$(this).css('background', 'linear-gradient(to bottom, ' + bg + ' 0%, ' + nextbg + ' 100%);');
console.log('linear-gradient(to bottom, ' + bg + ' 0%, ' + nextbg + ' 100%);');
console.log('------------');
}
});
【问题讨论】:
标签: jquery css gradient linear-gradients