0

I'm trying to animate a div's background color. I've downloaded jquery.color.js from here - http://plugins.jquery.com/project/color but it didn't work. I deleted the content of jquery.color.js, copy/pasted it from here - jQuery animate backgroundColor and saved it. Still nothing happens.

Here's the code:

<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>

I've tried src="@Url.Content("/Scripts/jquery.color.js")" instead of src="/Scripts/jquery.color.js", but then I get runtime error: 'jQuery' is undefined. I have no idea why it doesn't work.

Community
  • 1
  • 1

1 Answers1

0

Seems to be working ok for me. Probable because you included jquery twice.

http://jsfiddle.net/7wxyj/ jsfiddle is going really slow for me, so if that doesnt work check out the jsbin one:

http://jsbin.com/ejurov/2

Matt
  • 7,049
  • 7
  • 50
  • 77
  • Thank you! I removed and it finally works! :) – Anna Ivanova Aug 18 '11 at 09:56
  • @Anna Ivanova, just a suggestion. you may want to look into using googles. You can include it the same way, http://code.google.com/apis/libraries/devguide.html#jquery but this way jquery will most likely be cached so it would load faster, plus you don't waste your bandwidth and even if it's not cached it would probably load faster from google. – Matt Aug 18 '11 at 10:03