Javascript 悬停功能触发器

Javascript 悬停功能触发器,javascript,jquery,css,Javascript,Jquery,Css,我做了这个,当你将鼠标悬停在顶部导航栏上的“收藏”选项卡或侧边栏上时,底部的内容就会向下滑动,这正是我想要的。但我的问题是,当我悬停时,它会弹出,这不是我想要的。虽然它不是一个切换功能,我设置,但它似乎是这样的工作。有人能帮我吗 $('.down').hover(function() { $('.b2-a .has_scroll').stop().animate({ height: "22px" }, 500); $('.b2-b .slide-div')

我做了这个,当你将鼠标悬停在顶部导航栏上的“收藏”选项卡或侧边栏上时,底部的内容就会向下滑动,这正是我想要的。但我的问题是,当我悬停时,它会弹出,这不是我想要的。虽然它不是一个切换功能,我设置,但它似乎是这样的工作。有人能帮我吗

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

我认为你需要重新思考你的代码。看起来你在很多不同的事件中都有过这样的经历。您想让它在点击按钮并悬停时向上滑动吗?如果是,请执行以下操作:

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

我认为你需要重新思考你的代码。看起来你在很多不同的事件中都有过这样的经历。您想让它在点击按钮并悬停时向上滑动吗?如果是,请执行以下操作:

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

感谢用户1477388,我知道它非常有缺陷,我需要学习更多,更具逻辑性。非常感谢!感谢用户1477388,我知道它非常有缺陷,我需要学习更多,更具逻辑性。非常感谢!