测试以查看jQuery UI Tooltip是否打开 [英] Testing to see if a jQuery UI Tooltip is open
本文介绍了测试以查看jQuery UI Tooltip是否打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试控制 jQuery Tooltip 的自动打开和关闭.
I'm trying to control the automatic opening and closing of a jQuery Tooltip.
如何测试工具提示的当前状态是否为打开状态?
How do I test to see if the current status of a tooltip is open?
我正在使用所有内容的最新版本.
I'm using the most recent versions of everything.
谢谢!
推荐答案
您可以尝试检查是否有任何带有ui-tooltip
的类.
You can try by checking if there are any classes with ui-tooltip
.
$(".ui-tooltip").length
或者,您也可以使用API来检查它是否打开.您可以设置标志并使用以下方法进行检查:
Or, alternatively, you can use the API to check if it is open. You can set a flag and check using:
$(".selector").on("tooltipopen", function(event, ui) {
$(this).data("tooltip", true);
});
$(".selector").on("tooltipclose", function(event, ui) {
$(this).data("tooltip", false);
});
要了解工具提示的当前状态,可以使用以下方法:
To know the current status of the tooltip, you can use this:
$(".selector").data("tooltip");
如果打开则返回true
,如果关闭则返回false
.希望这会有所帮助...
It returns true
if open, and false
if closed. Hope this helps...
这篇关于测试以查看jQuery UI Tooltip是否打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文