我有以下HTML:jQuery的動畫
<div class="olympics" style="display: block; position: absolute; left: 250px; top: px;">
<a style="display: inline-block; float: left; height: 20px; margin: 5px;" href="#">Link 1</a>
<a style="display: inline-block; float: left; height: 20px; margin: 5px;" href="#">Link 2</a>
</div>
和JS:
$('.olympics a').hover(function() {
$(this).animate({
backgroundColor: "#aa0000",
color: "#fff"
}, 1000);
}, function() {
$(this).animate({
backgroundColor: "#fff",
color: "#aa0000"
}, 1000);
});
任何想法,爲什麼這個動畫不能正常工作?
的jsfiddle演示在這裏:http://jsfiddle.net/Seefeld/NzhxH/13/
不可避免的一個問題是如何停止動畫隊列(鼠標懸停在多次導致癲癇發作巨星)。使用'.stop()':http://jsfiddle.net/NzhxH/29/ –