jQuery Color Animation不起作用

时间:2011-08-18 09:06:50

标签: jquery animation colors

我正在尝试为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'未定义。 我不知道为什么它不起作用。

1 个答案:

答案 0 :(得分:0)

似乎对我有用。可能是因为你把jquery包括了两次。

http://jsfiddle.net/7wxyj/ jsfiddle对我来说真的很慢,所以如果不行,请查看jsbin:

http://jsbin.com/ejurov/2

相关问题