jQuery twitter bootstrap 工具提示插件中的数据延迟
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15170967/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Data delay in twitter bootstrap tooltips plugin
提问by Spyros
I am having trouble making that data-delay attribute of twitter bootstrap tooltips work. I am using it like :
我无法使 twitter bootstrap 工具提示的数据延迟属性起作用。我正在使用它:
Here is how i use it :
这是我如何使用它:
<a href="#" data-toggle="tooltip" data-delay="{ show: 5000, hide: 3000}">with delay</a><script>jQuery('a[data-toggle="tooltip"]').tooltip().click( function(e) { e.preventDefault(); }); </script>
but i don't see any delay on show/hide. Any ideas why ?
但我没有看到显示/隐藏的任何延迟。任何想法为什么?
回答by azeós
Finally I got it working with data attribute.
最后我让它与数据属性一起工作。
data-delay='{"show":"5000", "hide":"3000"}'
The object must be surrounded by single quotes, keys with double quotes and values with double or none, probably depends on the type. Is the only way that works.
对象必须用单引号、带双引号的键和带双引号或无的值括起来,这可能取决于类型。是唯一有效的方法。
This works for popovers too.
这也适用于弹出框。
回答by Gautam3164
Why can't you do it like this?
为什么你不能这样做?
$('a').tooltip({
'delay': { show: 5000, hide: 3000 }
});
回答by Rust
I prefer it this way:
我更喜欢这样:
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip({'delay': { show: 5000, hide: 3000 }
});
});
回答by Pascal
your answer doesn't work with Bootstrap 3.3.2. This one working well for my version:
您的答案不适用于 Bootstrap 3.3.2。这个很适合我的版本:
data-delay='{"show":5000, "hide":3000}'
回答by devsathish
You can use:
您可以使用:
<div ... popover-popup-delay="2000" ...>
回答by Jeffrey Roosendaal
For use with AngularJS (UI):
与 AngularJS (UI) 一起使用:
<div tooltip="Hello" tooltip-popup-delay="500"></div>