我想强调这个元素:.css()。animate()不工作?
$('input.step:last').css('background','#003').animate({'background':'#fff'},300);
但它不工作。
为什么呢?
我想强调这个元素:.css()。animate()不工作?
$('input.step:last').css('background','#003').animate({'background':'#fff'},300);
但它不工作。
为什么呢?
你需要JQuery.Color
插件(的jquery-ui
一部分)。然后呢,
$(document).ready(function(){
$('input.step:last')
.css({'backgroundColor':'#003'})
.animate({'backgroundColor':'#fff'},300);
})
要为动画颜色添加动画,您需要添加jQuery Animate Colors插件。
http://www.bitstorm.org/jquery/color-animation/
然后,你应该使用:
$('input.step:last').css('background-color','#003')
.animate({'background-color':'#fff'},300);
记住,你应该动画“背景颜色”属性,而不是“背景”一个区别。
我的不好,这是正确的答案 – 2012-03-02 15:52:37
默认情况下,jQuery can’t animate colors。您可以使用jQuery.color()
plugin, found here,来提供该能力。
包含jQueryUI。 – j08691 2012-03-02 15:51:13