jQuery-为什么我无法将“ div”的背景颜色更改为“黄色”

前端之家收集整理的这篇文章主要介绍了jQuery-为什么我无法将“ div”的背景颜色更改为“黄色” 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

$('div').animate({ 'background':'yellow' },2000,'linear',function() {
        })

为什么??

谢谢

最佳答案
从jQuery API(http://api.jquery.com/animate/):

All animated properties should be
numeric (except as noted below);
properties that are non-numeric cannot
be animated using basic jQuery
functionality. (For example,width,
height,or left can be animated but
background-color cannot be
.) Property
values are treated as a number of
pixels unless otherwise specified. The
units em and % can be specified where
applicable.

要设置颜色动画,请使用jQuery.color插件http://plugins.jquery.com/project/color

猜你在找的jQuery相关文章