Javascript 在空闲但背景正在更改时禁用鼠标悬停

Javascript 在空闲但背景正在更改时禁用鼠标悬停,javascript,jquery,Javascript,Jquery,有一个div,它包含一个表,您可以在其中使用上/下箭头和鼠标(mousemove/mouseout)选择行。在向上/向下滚动具有固定高度的div。当我使用“向上/向下”选择行时,问题就开始了,同时如果指针也指向表,即具有指针焦点的行,则每次都会因为我认为的滚动条而被选中:( 鼠标盖和鼠标移动--> $(“body”).delegate(“.item搜索结果tr”,“mouseover”,function(){ $(“.item detail”).removeClass(“tr活动”); $(此)

有一个div,它包含一个表,您可以在其中使用上/下箭头和鼠标(mousemove/mouseout)选择行。在向上/向下滚动具有固定高度的div。当我使用“向上/向下”选择行时,问题就开始了,同时如果指针也指向表,即具有指针焦点的行,则每次都会因为我认为的滚动条而被选中:(

鼠标盖和鼠标移动-->

$(“body”).delegate(“.item搜索结果tr”,“mouseover”,function(){
$(“.item detail”).removeClass(“tr活动”);
$(此).addClass(“tr活动”);
});
$(“body”).delegate(“.item搜索结果tr”,“mouseout”,function(){
$(此).removeClass(“tr活动”);
});
$(文档).keyup(函数(e){
如果(e.keyCode==38){
currFormRow=parseInt($(“#hfcurrow”).val();
如果(currDetailIndex!=-1){
newIndex=--currDetailIndex;
$(“.item detail).removeClass(“tr活动”);
$(“.td_detail_”+currFormRow).addClass(“tr活动”);
}
如果(e.keyCode==40){
currFormRow=parseInt($(“#hfcurrow”).val();

如果选择器
$(“.item detail”).removeClass(“tr active”);
缺少(currDetailIndexline)2双引号,我看到
委托
,您使用的是哪个版本的jQuery?@Satpal代码工作正常。我编辑代码是为了提示我的问题。问题在于功能。顺便说一句,版本是1.10.2
$("body").delegate(".item-search-result tr","mouseover",function(){
        $(".item-detail").removeClass("tr-active");
        $(this).addClass("tr-active");           
    });
    $("body").delegate(".item-search-result tr","mouseout",function(){         
        $(this).removeClass("tr-active");        
    });

$(document).keyup(function(e) {
    if (e.keyCode == 38) {   
    currFormRow = parseInt($("#HfCurrRow").val());
    if(currDetailIndex!=-1){
    newIndex = --currDetailIndex;
    $(".item-detail).removeClass("tr-active");
    $(".td_detail_"+currFormRow).addClass("tr-active");
    }

  if (e.keyCode == 40) {
    currFormRow = parseInt($("#HfCurrRow").val());
    if(currDetailIndex<($("#item-searchresult_"+currFormRow).children("tr").length)-1){
          newIndex = ++currDetailIndex;
         $(".item-detail).removeClass("tr-active");
         $(".td_detail_"+currFormRow).addClass("tr-active");
    }
  }
   $("#HfCurrRow").val(currFormRow);
});