我正在使用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 = '';
});
}
function 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(); }
function demovetooltip(e){jQuery(“#tooltipwindow”)
.css(“top”,(e.pageY - jQuery(window).scrollTop())+“px”)
.css(“left”,(e.pageX)+“px”); }
另外一件事,超链接点击似乎已被禁用现在我已将此悬停在上面?
汤姆
答案 0 :(得分:0)
我把它解决了......我只是将鼠标悬停在远离鼠标的位置
答案 1 :(得分:0)
我有一个非常类似的问题。结果是导致NaNs或负值的数学函数。
我会检查这样的部分数学:e.pageY - jQuery(window).scrollTop()