我有li元素:如何动画颜色?
<ul>
<li><a href="">test 1</a></li>
<li><a href="">test 2</a></li>
</ul>
,我想,一个新的颜色来自底部动画悬停颜色。
怎么办?
我有li元素:如何动画颜色?
<ul>
<li><a href="">test 1</a></li>
<li><a href="">test 2</a></li>
</ul>
,我想,一个新的颜色来自底部动画悬停颜色。
怎么办?
您需要使用此jQuery PlugIn才能为颜色提供animate()功能!
使用示例(从GitHub页面复制!)
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color:#bada55;
width:100px;
border:1px solid green;
}
</style>
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script src="jquery.color.min.js"></script>
</head>
<body>
<button id="go">Simple</button>
<button id="sat">Desaturate</button>
<div id="block">Hello!</div>
<script>
$("#go").click(function(){
$("#block").animate({
backgroundColor: "#abcdef"
}, 1500);
});
$("#sat").click(function(){
$("#block").animate({
backgroundColor: $.Color({ saturation: 0 })
}, 1500);
});
</script>
</body>
</html>
刚上文字或背景? – mrzmyr
你能把我们连接到一个例子吗? – sirmdawg
[你有什么尝试?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – j08691