javascript - jquery 动画功能不起作用

标签 javascript jquery jquery-ui

在以下 JQuery 代码中,动画函数不起作用:

$('#current_item').css({'background-color':'#88ff88'}).animate({'background-color' : '#114411'}, 1000);`   

谁能帮我找出原因

最佳答案

如果不使用其他插件,您就无法设置背景颜色的动画。来自 jQuery docs :

All animated properties should be animated to a single numeric value, except as noted below; most 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, unless the jQuery.Color() plugin is used).

关于javascript - jquery 动画功能不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19721900/

相关文章:

jquery - 如何使所有 li 组件都可以为每个 ul 父级排序?

javascript - fadeOut 然后改变图像

Jquery显示/隐藏密码

javascript - 通过 jquery corrupt carousel 添加 css 样式

jquery - Javascript 通过复选框更改 div 的宽度

javascript - 同一页面中两个 jquery Accordion 的不同样式

javascript - 使用自定义 jQuery slider 和键盘键检测事件

javascript - jQuery 读取的 CSS 与 jQuery 设置的 CSS 不对应

javascript - 在 Ext 3.4 框架上使用 debounce

javascript - 查找 td 索引并将颜色应用于 tr