Javascript 使用反弹效果时的jQuery错误

Javascript 使用反弹效果时的jQuery错误,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,我对jQuery反弹效果有问题。在并没有弹跳的情况下,每件事情都会很好地工作——有弹跳,当你们在按钮上快速移动很多次时——有时候,盒子不会隐藏。这个jsfiddle出了什么问题 我的朋友: 我的JS: $('.flex_section').delegate('a','mouseenter mouseleave',function(e){ var a = $(this).attr('id'); if (e.type == 'mouseenter'){ clearTimeout(t_on

我对jQuery反弹效果有问题。在并没有弹跳的情况下,每件事情都会很好地工作——有弹跳,当你们在按钮上快速移动很多次时——有时候,盒子不会隐藏。这个jsfiddle出了什么问题

我的朋友:

我的JS:

$('.flex_section').delegate('a','mouseenter mouseleave',function(e){
var a = $(this).attr('id');

if (e.type == 'mouseenter'){

    clearTimeout(t_on)

    if (a == 'abc'){
    clearTimeout(t_off)     
    t_on = setTimeout(function() { popup_show(a,t_on); }, 10);
    }
} else {

    t_off = setTimeout(function() { popup_remove(a,t_off); }, 1000);
}
)}

function popup_show(type,string){
if (type == 'abc'){

    $('#pc_' + type).css('display','block');
    $('#pc_' + type).effect( "bounce",{times:3,distance:20},1000);
}
clearTimeout(string);
}
function popup_remove(type,string){
    $('#pc_' + type).css('display','none');
    clearTimeout(string)
}
试用

保持简单:

function popup(){
    $('.flex_top a').hover(function(){
        var type = $(this).attr('id');
        var offset = $('#' + type).offset();
        $('#id_' + type).css('display','block')
        .offset({left:offset.left + 100, top:offset.top + 380})
        .effect( "bounce",{times:3,distance:20},1000);
    },function(){
       var type = $(this).attr('id');
       $('#id_' + type).fadeOut();
    }
  );
}

当我添加“停止”或“完成”时,不要多次调用同一对象搜索$'id_'+type

。框有时会丢失权限。它工作得更好,但现在当我在按钮上快速移动多次时,许多框出现问题。但这是一些进步:
function popup(){
    $('.flex_top a').hover(function(){
        var type = $(this).attr('id');
        var offset = $('#' + type).offset();
        $('#id_' + type).css('display','block')
        .offset({left:offset.left + 100, top:offset.top + 380})
        .effect( "bounce",{times:3,distance:20},1000);
    },function(){
       var type = $(this).attr('id');
       $('#id_' + type).fadeOut();
    }
  );
}