gpt4 book ai didi

javascript - 如何保持 qtip 固定

转载 作者:行者123 更新时间:2023-11-28 02:47:36 26 4
gpt4 key购买 nike

我正在使用 jQuery 的 qtip,并且我有以下代码

$('#content a[href]').qtip(
{
content: 'Some basic content for the tooltip', // Give it some content, in this case a simple string
style: {
name: 'cream', // Inherit from preset style
tip: 'topLeft'
},
show: {
when: 'click', // Show it on click...
solo: true // ...and hide all others when its shown
},
hide: {
when : 'focusout',
fixed: true
}
});

期望的效果是,当我单击链接时,提示应该显示并保留在那里,除非我单击页面的其他部分(因此焦点),但同时如果我单击提示本身,我不希望它消失,以便我可以在其中插入有趣的东西,因此固定:true...但即使当我这样做时,当我单击提示时它仍然会消失...我是什么做错了,或者是否有其他方法可以防止提示在我单击它时消失,但如果我单击页面的其他部分则让它消失?

最佳答案

您需要使用unfocus事件:

$('#content a[href]').qtip({
content: 'Some basic content for the tooltip',
// Give it some content, in this case a simple string
style: {
name: 'cream',
// Inherit from preset style
tip: 'topLeft'
},
show: {
when: 'click',
// Show it on click...
solo: true // ...and hide all others when its shown
},
hide: {
when: { event: 'unfocus' }
}
});

工作演示:http://jsfiddle.net/andrewwhitaker/rep87/

来自documentation :

The 'unfocus' event hides the tooltip when anywhere else on the document, except the tooltip itself, is clicked.

<小时/>

关于javascript - 如何保持 qtip 固定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4516353/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com