我在Firefox中遇到这个小问题,我无法修复......有没有人知道可能的解决方案?
TypeError:事件未定义 tippy_positions.curPageX = event.clientX + tippy_positions.scrollPageX; in(第335行,第3栏)http://example.com/wp-content/plugins/tippy/jquery.tippy.js?ver=6.0.0
当autoshow = true时,这只会在firefox中打破整个网站。 这里有文件链接:https://github.com/thechrisroberts/tippy/blob/master/jquery.tippy.js
谢谢!
答案 0 :(得分:0)
有时如果你试图直接访问事件对象,那么它在chrome中运行但不在firefox中运行。所以解决方案是采取与div相关的自定义位置
打开jquery.tippy.js 转到函数getPositions(第323行)
将第325行替换为349
if (!event) {
event = window.event;
}
var x = '';
var y = '';
if( event == undefined ) {
var offset = $("#"+tipId+"_link").offset();
x = offset.left;
y = offset.top;
} else {
x = event.clientX;
y = event.clientY;
}
tippy_positions.scrollPageX = $(window).scrollLeft();
tippy_positions.scrollPageY = $(window).scrollTop();
tippy_positions.viewScreenX = $(window).width();
tippy_positions.viewScreenY = $(window).height();
tippy_positions.curPageX = x + tippy_positions.scrollPageX;
tippy_positions.curPageY = y + tippy_positions.scrollPageY;
tippy_positions.viewPageX = x;
tippy_positions.viewPageY = y;
它会对你有用!!