【问题标题】:jQuery hoverover image works fine one direction, jumpy the otherjQuery 将鼠标悬停在图像上一个方向工作正常,另一个方向跳跃
【发布时间】:2012-02-29 09:30:58
【问题描述】:

我正在使用 jquery/javascript 来处理悬停,该悬停应该跟随用户将鼠标悬停在图像地图上。它可以工作,但一个方向很好(向左),但当你向右走时,它真的很跳动。我在这里制作了一个视频来展示这个问题:

http://screencast.com/t/rnm1jUkvv8P

这是我的代码:

if (sPage == "fireplan.aspx") {
    jQuery('area').mousemove(function(e) { deshowtooltip(e, this) });
   // jQuery('area').mousemove(function(e) { demovetooltip(e) });

    jQuery('area').mouseout(function() {
        jQuery('#tooltipwindow').empty();
        delasturl = '';

    });


}

函数 deshowtooltip(e, element) { var url = jQuery(element).attr('tooltiphref');

if (delasturl != url) {
    jQuery('#tooltipwindow').empty();
    jQuery('#tooltipwindow').load('tooltip.aspx?soid=' + url);
    delasturl = url;
}

var $this = jQuery(element);
$this.data('title', $this.attr('title'));
$this.removeAttr('title');

jQuery("#tooltipwindow").css("position", "fixed").css("top", (e.pageY - jQuery(window).scrollTop()) + "px").css("left", (e.pageX) + > "px").css("display", "none").show(); }

函数 demovetooltip(e) { jQuery("#tooltipwindow")
.css("top", (e.pageY - jQuery(window).scrollTop()) + "px")
.css("left", (e.pageX) + "px"); }

另外一件事,现在我已经将鼠标悬停在上面,似乎禁用了超链接点击?

汤姆

【问题讨论】:

    标签: javascript jquery html


    【解决方案1】:

    我解决了...我只是将鼠标悬停在远离鼠标一点点

    【讨论】:

      【解决方案2】:

      我有一个非常相似的问题。原来是数学函数导致 NaN 或负值。

      我会检查如下部分的数学:e.pageY - jQuery(window).scrollTop()

      【讨论】:

        猜你喜欢
        • 2013-03-29
        • 2017-09-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-25
        • 1970-01-01
        • 1970-01-01
        • 2015-11-18
        相关资源
        最近更新 更多