jQuery .slide和.slideUp。没开

时间:2012-05-09 11:05:52

标签: javascript jquery css slide

我制作了这个剧本:

$("#comments .comment .links").hide();
$("#comments .comment").hover(
    function() { $(".links", this).stop(true).slideDown(300); },
    function() { $(".links", this).stop(true).slideUp(300); }
);

现在我遇到了问题。当我将鼠标悬停在评论div上时。我徘徊了几次。那个.links div不再显示了。 div没有完全打开。

我该如何解决?

2 个答案:

答案 0 :(得分:1)

试试这个

$("#comments .comment .links").hide();
$("#comments .comment").hover(
    function() { $(".links", this).not(":animated").slideDown(300); },
    function() { $(".links", this).not(":animated").slideUp(300); }
);

OR

$("#comments .comment .links").hide();
$("#comments .comment").hover(
    function() { 
                  $(".links", this).stop(true, true).slideToggle();
               }
);

答案 1 :(得分:1)

稍作修改就可以了。

$("#comments .comment .links").hide();
$("#comments .comment").hover(
    function() { $(".links", this).stop(true, true).slideDown(300); },
    function() { $(".links", this).stop(true, true).slideUp(300); }
);​