admin管理员组文章数量:1331230
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);
update
This works fine
$(document.getElementById(id)).animate({ width: "400px" }, 500);
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);
update
This works fine
$(document.getElementById(id)).animate({ width: "400px" }, 500);
Share
Improve this question
edited May 29, 2013 at 13:35
HBP
16.1k6 gold badges29 silver badges34 bronze badges
asked May 29, 2013 at 13:07
124697124697
21.9k69 gold badges197 silver badges319 bronze badges
1
-
2
Try
$('#' + id).animate({ backgroundColor: "#4E1402" }, 500);
instead. – Bucket Commented May 29, 2013 at 13:09
3 Answers
Reset to default 6jQuery cannot animate color. Use this plugin instead.
http://www.bitstorm/jquery/color-animation/
( just a 4kb addition )
Or the jquery UI animate :
http://jqueryui./animate/ ( as mentioned by @Adam below )
You need this plugin to animate the colors with jQuery : http://archive.plugins.jquery./project/color
Have you included jquery-ui library as well?
If I remember good, current element that you are reffering to, must have some background color set at start.
本文标签: javascriptJquery background colour change animate not workingStack Overflow
版权声明:本文标题:javascript - Jquery background colour change animate not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742216854a2434727.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论