ane*_*yzm 23 javascript jquery jquery-plugins qtip
我正在使用jquery-plugin qTip.在我的页面中销毁所有工具提示的命令是什么?
我试过了:
$('.option img[title], span.taxonomy-image-link-alter img[title]').qtip("destroy");
Run Code Online (Sandbox Code Playgroud)
但它没有用......谢谢
bip*_*obe 19
qTip2是这个脚本的新版本,但我想指出一件事.
$(".qtip").remove();
Run Code Online (Sandbox Code Playgroud)
这段代码没有破坏所有的工具提示 - 它只是删除了他们的容器.附加到调用工具提示的对象的所有处理程序和事件仍然可以在浏览器的内存中使用.
在qTip中删除工具提示和它的处理程序scompletely你必须使用:
$(mytooltip).qtip("destroy");
Run Code Online (Sandbox Code Playgroud)
要么
$(mytooltip).qtip('api').destroy();
Run Code Online (Sandbox Code Playgroud)
在qTip2中使用此:
$(mytooltip).remove();
Run Code Online (Sandbox Code Playgroud)
会自动调出api并彻底销毁工具提示和它的处理程序.
Ste*_*wie 16
$('.qtip').each(function(){
$(this).data('qtip').destroy();
})
Run Code Online (Sandbox Code Playgroud)
gam*_*ela 11
qtip("destroy") 有缺陷(版本2.1.1)并没有清除一切.
我发现这是一个正确的解决方法:
// don't call destroy if not needed
if (element.data("qtip")) {
// the 'true' makes the difference
element.qtip("destroy",true);
// extra cleanup
element.removeData("hasqtip");
element.removeAttr("data-hasqtip");
}
Run Code Online (Sandbox Code Playgroud)