2

我创建了这个网站,当您将鼠标悬停在顶部导航栏或侧边栏上的收藏选项卡上时,底部内容会向下滑动,这正是我想要的。但是我的问题是,当我将鼠标悬停在外面时,它会弹出,这不是我想要的。虽然它不是我设置的切换功能,但它似乎像它一样工作。有人可以帮助我吗?

$('.down').hover(function() {
    $('.b2-a .has_scroll').stop().animate({
        height: "22px"
    }, 500);
    $('.b2-b .slide-div').stop().animate({
        height: "19px"
    }, 500);
    $("#slide-title h4").show();
    $(".slide-div").animate({
        marginTop: "-12px"
    });
    $('.b2 .tancar').animate({
        backgroundPosition: '28px 4px'
    })
}, function() {
    $('.b2-a .has_scroll').stop().animate({
        height: "120px"
    }, 500);
    $('.b2-b .slide-div').stop().animate({
        height: "438px"
    }, 500);
    $("#slide-title h4").hide();
    $(".slide-div").animate({
        marginTop: "-12px"
    });
    $('.b2 .tancar').animate({
        backgroundPosition: '28px -19px'
    })
});
4

1 回答 1

0

我认为您需要重新考虑您的代码。看起来你已经让它在许多不同的事件中上升了。您是否希望它在单击按钮和悬停时向上滑动?如果是这样,请执行以下操作:

$('.b2').hover(function() {
  // do animation to show
));
$('#clic').click(function() {
  // do animation to show
));
$('.b2').mouseout(function() {
  // do animation to hide
));
于 2012-09-13T15:08:08.070 回答