[英]Jquery background colour change animate not working
我想將輸入框的背景從白色更改為另一種顏色,然后以緩慢淡入的方式再次返回白色。 我試過動畫它根本不起作用。 沒有錯誤。
<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無法為顏色設置動畫。 請改用此插件。
http://www.bitstorm.org/jquery/color-animation/
(僅增加4kb)
或者jquery UI動畫:
http://jqueryui.com/animate/ (如下面的@Adam所述)
你需要這個插件來使用jQuery為顏色設置動畫: http : //archive.plugins.jquery.com/project/color
你也包括jquery-ui庫嗎?
如果我記得你正在做的好的當前元素,必須在開始時設置一些背景顏色。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.