Jquery并发事件关系

Jquery并发事件关系,jquery,mouseevent,bind,unbind,Jquery,Mouseevent,Bind,Unbind,我不知道当一个事件与另一个事件同时触发时,如何将它们解除绑定。我有这种html层次结构: <div class="first"></div> <div class="second"></div> 有什么线索吗 以下是示例:超时 var hideTimer; $('.first').mouseenter(function(){ $('.second').show(); }); $('.first').mouseleave(functio

我不知道当一个事件与另一个事件同时触发时,如何将它们解除绑定。我有这种html层次结构:

<div class="first"></div>
<div class="second"></div>
有什么线索吗

以下是示例:

超时

var hideTimer;

$('.first').mouseenter(function(){
    $('.second').show();
});

$('.first').mouseleave(function(){
    hideTimer = setTimeout(function() {
       $('.second').hide();
    }, 500);
});

$('.second').mouseenter(function(){
     clearTimeout(hideTimer);
     $('.first').unbind('mouseleave');
});

$('.second').mouseleave(function(){
     $('.first').bind('mouseleave');
     $('.second').hide();
});
根据您的需要调整它,因为我不确定是否正确地遵循了您的逻辑:P


您没有鼠标指针。首先..?创建。这是一个几乎没有变化的鼠标指针。非常感谢,这篇文章帮助我理解want是错的。
var hideTimer;

$('.first').mouseenter(function(){
    $('.second').show();
});

$('.first').mouseleave(function(){
    hideTimer = setTimeout(function() {
       $('.second').hide();
    }, 500);
});

$('.second').mouseenter(function(){
     clearTimeout(hideTimer);
     $('.first').unbind('mouseleave');
});

$('.second').mouseleave(function(){
     $('.first').bind('mouseleave');
     $('.second').hide();
});