我正在使用color plugin(链接到谷歌缓存,jquery.com目前关闭)来处理背景颜色动画。
$(".navigation a").hover(
function(){
$(this).stop().animate({backgroundColor: black});
},
function(){
$(this).stop().animate({backgroundColor: green});
$(this).hide();
}
);
动画完成后需要隐藏当前链接。现在它会立即隐藏在mouseout()
上。
解决方案是什么?
答案 0 :(得分:5)
您需要将.hide()
放入.animate()
来电的回调函数中。
$(this).stop().animate(
{backgroundColor: green},
function() {
$(this).hide();
}
);
答案 1 :(得分:2)
通过给.hide()
一个持续时间,它将被添加到动画队列中。
所以你可以这样做:
$(this).stop().animate({backgroundColor: green}).hide( 0 );