jQuery的动画背景色上输入按键不灵

问题描述:

我绝对不知道为什么背景颜色没有改变,我已经花了太多时间在上面已经:jQuery的动画背景色上输入按键不灵

<input type="button" class="front-consultation-btn" value="Get A Free Consultation"> 

<script> 
    $('.front-consultation-btn').animate({ backgroundColor: '#FF0000', width: 400 }, 500); 
</script> 

为什么这只更改宽度属性?

+0

见http://stackoverflow.com/questions/190560/jquery-animate-backgroundcolor – 2012-08-14 19:22:28

为什么不使用CSS3?

.yourelement { 
    background: #fff; 
} 

.yourelement:focus, .yourelement:hover { 
    -webkit-transition: background-color 0.5s linear; 
    background: #ccc; 
} 
+2

我D说因为U不能给它添加回调吗? – DarkBee 2014-11-04 10:48:18

这是因为jQuery不支持动画的默认颜色,jQueryUI的添加此功能:http://jqueryui.com/demos/animate/

+2

这是荒谬的。 – dcolumbus 2012-08-14 20:26:07

+0

[这里](http://www.bitstorm.org/jquery/color-animation/)使用起来相当简单。 – Pathros 2016-03-07 17:20:27