【问题标题】:Various speed problems with hoverIntenthoverIntent 的各种速度问题
【发布时间】:2011-06-23 18:19:35
【问题描述】:

我在让 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 的 pop-up-div。

【问题讨论】:

    标签: jquery hoverintent


    【解决方案1】:

    我认为你最后的物理 .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();
              });
    
            }
        }
    

    【讨论】:

    • @Øyvind 你能告诉我更多关于“#inndato”和“#arrinfo”的信息吗?为什么弹出 div 的内容控制重新加载 '#arrinfo' div?就目前而言,“#inndato”永远不会填满,“#arrinfo”会。
    猜你喜欢
    • 2016-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-23
    • 2019-02-12
    • 2018-09-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多