我正在使用Tipsy jquery插件,焦点触发器的行为方式与悬停触发器相同。一旦我的鼠标离开输入字段,即使该字段仍然聚焦,也会停止显示。什么可能导致这个问题?基于此jQuery tipsy plugin. On focus trigger not working。这不是导致问题的实际插件
这是我在
上测试它的页面答案 0 :(得分:2)
您需要更新正在使用的Tipsy文件。 The one you are using目前与the latest version of Tipsy明显不同。
答案 1 :(得分:1)
正如Haochi所说,你需要将你的Tipsy版本更新为1.0.0a。然后使用以下代码将悬停和焦点添加到您的醉意工具提示(demo):
$('.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");
}
});