<!-- include Google's AJAX API loader -->
<script src="http://www.google.com/jsapi"></script>
<!-- load JQuery and UI from Google (need to use UI to animate colors) -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#menuknop1").hover(function() {
$(this).animate({"color":"black"}, "slow");
}, function() {
$(this).animate({"color":"white"}, "slow");
});
});
</script>
<div id="menuknop1"><i>Home</i></div>
I’m trying to animate this piece of code so that the text turns black when hovered and white when left the area. Why isn’t this working?
Load jQuery first — jQuery-UI is a plugin, and doesn’t contain jQuery itself:
Aside from that, your code works just fine here: http://jsfiddle.net/mblase75/pMeJc/ — provided you use jQuery 1.7.2.
jsFiddle won’t let me select jQuery UI 1.8.18 with jQuery 1.8.0, so apparently it’s not compatible with that version. According to the jQuery-UI website, “ 1.8.23 fixes all known issues with jQuery 1.8.0.”