<!-- 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>
我正在尝试为这段代码设置动画,以便文本在悬停时变为黑色,在离开该区域时变为白色。为什么这不起作用?