悬停功能触发器

时间:2012-09-13 14:55:03

标签: javascript jquery css

我做了这个website当你将鼠标悬停在顶部导航栏上的COLLECTION标签上或侧栏上时,底部内容会向下滑动,这正是我想要的。但我的问题是,当我徘徊时,它会弹回来,这不是我想要的。虽然它不是我设置的切换功能,但它看起来像它一样工作。有人可以帮帮我吗?

$('.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'
    })
});

1 个答案:

答案 0 :(得分:0)

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

$('.b2').hover(function() {
  // do animation to show
));
$('#clic').click(function() {
  // do animation to show
));
$('.b2').mouseout(function() {
  // do animation to hide
));