Jquery背景颜色改变动画不起作用 [英] Jquery background colour change animate not working

查看:134
本文介绍了Jquery背景颜色改变动画不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将输入框的背景从白色更改为另一种颜色,然后以缓慢淡入的方式再次返回白色。我试过动画它根本不起作用。没有错误。

I want to change the background of an inputbox from white to another colour and then back to white again in a slow fading way. i have tried the animate it simply doesn't work. there is no error.

<script type="text/javascript" src="/jsp/ui/jquery-ui/js/jquery-1.8.3.min.js"></script>
...
$(document.getElementById(id)).animate({ backgroundColor: "#4E1402" }, 500);

更新

这很好用

$(document.getElementById(id)).animate({ width: "400px" }, 500);


推荐答案

jQuery无法为颜色设置动画。请改用此插件。

jQuery cannot animate color. Use this plugin instead.

http://www.bitstorm .org / jquery / color-animation /

(仅增加4kb)

或jquery UI animate:

Or the jquery UI animate :

http://jqueryui.com/animate/(如下面的@Adam所述)

http://jqueryui.com/animate/ ( as mentioned by @Adam below )

这篇关于Jquery背景颜色改变动画不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆