0

我在让 hoverIntent 正常工作方面遇到了一些问题。

问题不断出现:

  • 通常,当我更改为另一个 div 时,鼠标悬停不会出现悬停。如果我稍微移动它,它就不会出现。我必须把鼠标拿出来,然后再进去让它工作。
  • 偶尔,不透明度很低,而且尺寸不对。它似乎在 slideUp() 部分的最后阶段冻结了。我必须刷新页面才能使其正常工作...

       $(".info").hoverIntent({
                结束:显示,
                出:隐藏
            });
    
    函数显示(){
        if($("#inndato").html() == " ") {
            // 让 popup-div 位置靠近 mouseover-div
            var 位置 = $(this).position();
            $("#arrinfo").css( { "left": (position.left + $(this).width()) + "px", "top":position.top + "px", "position": “绝对”});
            $("#arrinfo").html(ajax_load).load(loadUrl);
            $("#arrinfo").show();
        }
    }
    
    函数隐藏(){
        $("#arrinfo").stop().slideUp("fast");
    }

我有很多 div(日历 -> 天),分配给 info-class 的那些应该使用 id #inndato 激活弹出 div。

4

1 回答 1

0

我认为你最后的物理 .show() 可以在 Ajax 返回之前执行。我将您的 Show() 函数移到 .load() 调用的“成功”部分。我做了一个假设,“ajax_load”是返回结果,是你的错字。如果 'ajax_load' 变量出现问题,我深表歉意,您可以告诉我。

function show(){ 
        if($("#inndato").html() == " ") {
            // To give the popup-div position close to the mouseover-div 
            var position = $(this).position();
            $("#arrinfo").css( { "left": (position.left + $(this).width()) + "px", "top":position.top + "px", "position":"absolute" } );
            //below duplicates the work of 'load', unless something special is in ajax_load               //that i don't know about
    //$("#arrinfo").html(ajax_load).load(loadUrl);
    //i think you mean this
           $("#arrinfo").load(loadUrl, function(data,text,xhr){
                //$("#arrinfo").show(); but try below first...
                $(this).show();
          });

        }
    }
于 2011-02-08T22:07:43.170 回答