【发布时间】:2011-08-18 09:06:49
【问题描述】:
我正在尝试为 div 的背景颜色设置动画。我已经从这里下载了 jquery.color.js - http://plugins.jquery.com/project/color 但它没有用。我删除了 jquery.color.js 的内容,从这里复制/粘贴 - jQuery animate backgroundColor 并保存了它。 仍然没有任何反应。
代码如下:
<link href="@Url.Content("/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("/Scripts/jquery-1.6.1.js")" type="text/javascript"></script>
<script src="@Url.Content("/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
<script src="/Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.color.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#firstDiv').animate({ backgroundColor: '#ff9f5f' }, 2000);
});
</script>
我尝试使用 src="@Url.Content("/Scripts/jquery.color.js")" 而不是 src="/Scripts/jquery.color.js",但随后出现运行时错误:' jQuery' 未定义。 我不知道为什么它不起作用。
【问题讨论】:
-
为什么 jquery 包含两次?
-
@Matt:没错,尤其是为什么会有两个不同的版本?