Javascript Bootstrap popover在iPad上不起作用
我有一个bootstrap popover在工作,所以:Javascript Bootstrap popover在iPad上不起作用,javascript,jquery,twitter-bootstrap,Javascript,Jquery,Twitter Bootstrap,我有一个bootstrap popover在工作,所以: 弹出窗口在单击时打开 当您在弹出框外单击时,弹出框关闭 如果禁用JS,则Popover具有默认href 代码是: <a class="badge badge-popover" data-original-title="title here" data-trigger="focus" data-placement="right" data-content="<p>Content Here&l
<a class="badge badge-popover"
data-original-title="title here"
data-trigger="focus"
data-placement="right"
data-content="<p>Content Here</p>" data-html="true"
href="/help">?</a>
$('.badge-popover').click(function(e){
e.preventDefault();
}).popover();
$('.badge popover')。单击(函数(e){
e、 预防默认值();
}).popover();
它在所有浏览器上都能正常工作,但在iPad上不行。你知道为什么吗?我哪里做错了?
谢谢:)
我正在使用Jquery 1.9.1、bootstrap 2.1.1尝试使用
悬停事件:
这将通过悬停触发桌面上的Popover,并通过单击(触摸)触发手机/平板电脑上的Popover
请参考以下代码片段以使其正常工作:
$('[data-toggle="popover"]').popover();
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
这是检测主体上的单击并关闭页面上所有工具提示的最简单方法
您可以查看这个实例
谢谢 刚刚遇到了同样的问题。将data trigger=“focus”
更改为data trigger=“click”
有效。悬停也可以使用。将数据触发器=“focus”更改为数据触发器=“click”几乎可以使用,但问题是,即使在弹出框外部单击,弹出框仍保持打开状态,只有在单击元素时才能关闭,启动了popover…您使用的是最新版本的jQuery吗?@Jivings我使用的是1.9.1在click@Ohgodwhy,不,这似乎不起作用——这在iOS6上对我很有效
$('[data-toggle="popover"]').popover();
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});