动画结束时jQuery捕获

Jam*_*mes 1 jquery animation background colors

我正在使用颜色插件(链接到谷歌缓存,jquery.com目前关闭)来处理背景颜色动画.

$(".navigation a").hover(
    function(){
        $(this).stop().animate({backgroundColor: black});
    },
    function(){
        $(this).stop().animate({backgroundColor: green});
        $(this).hide();
    }
);
Run Code Online (Sandbox Code Playgroud)

动画结束时需要隐藏当前链接.现在它立刻隐藏起来了mouseout().

解决办法是什么?

nic*_*ckf 5

您需要将其.hide()置于调用的回调函数中.animate().

$(this).stop().animate(
    {backgroundColor: green},
    function() {
        $(this).hide();
    }
);
Run Code Online (Sandbox Code Playgroud)