2012-08-29 30 views
1
<!-- 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> 

我试图给这段代码添加动画,以便文本在盘旋时变为黑色,在离开区域时变为白色。为什么这不起作用?jquery UI中的动画(文本)颜色jQuery中的

回答

2

负荷的jQuery第一 - jQuery的用户界面是一个插件,并且不包含jQuery的本身:

<!-- load JQuery and UI from Google (need to use UI to animate colors) --> 
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> 

除此之外,你的代码只是正常的位置:http://jsfiddle.net/mblase75/pMeJc/ - 只要你使用jQuery 1.7 0.2。

jsFiddle不会让我用jQuery 1.8.0,so apparently it's not compatible with that version选择jQuery UI 1.8.18。根据jQuery-UI网站,“ 1.8.23 fixes all known issues with jQuery 1.8.0”。

+0

我忘了/故意没有粘贴到这个盒子假设人们会明白我已经有这些。对不起,但我已经有这两个。任何其他形式的jQuery的作品。 – Ridz

+0

+1,似乎有错误,当使用jQ 1.8和用户界面 - [FIDDLE](http://jsfiddle.net/VzJzn/3/)... – adeneo

+0

感谢您的帮助,但仍然没有发生... – Ridz