我正在使用 Tipsy jquery 插件,焦点触发器的作用与悬停触发器相同。一旦我的鼠标离开输入字段,即使该字段仍处于焦点,Tipsy 也会停止显示。什么可能导致这个问题?基于这个jQuery Tipsy 插件。焦点触发器不起作用。这不是导致问题的实际插件
这是我正在测试的页面
我正在使用 Tipsy jquery 插件,焦点触发器的作用与悬停触发器相同。一旦我的鼠标离开输入字段,即使该字段仍处于焦点,Tipsy 也会停止显示。什么可能导致这个问题?基于这个jQuery Tipsy 插件。焦点触发器不起作用。这不是导致问题的实际插件
这是我正在测试的页面
您将需要更新您正在使用的 Tipsy 文件。您现在使用的与最新版本的 Tipsy有很大不同。
正如 Haochi 所说,您需要将 Tipsy 版本更新为1.0.0a。然后使用以下代码将悬停和焦点添加到您的提示工具提示(演示):
$('.registerform [title]')
.tipsy({
trigger: 'manual', // manual stops binding of any internal tipsy events
gravity: 'w',
fade: true
})
.bind('focus mouseenter', function(e) {
// flag indicating the input has focus
if (e.type === 'focus') {
$(this).addClass('hasFocus');
}
$(this).tipsy("show");
})
.bind('blur mouseleave', function(e) {
// if mouseleave is triggered but the input has focus, ignore it
if (!$(this).is('.hasFocus') || e.type === 'blur') {
$(this).removeClass('hasFocus').tipsy("hide");
}
});