使用Bootstrap 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');
}
});
});
但是当我使用这部分代码时,虽然可以关闭弹出窗口,但是我无法点击其他按钮,有没有人知道如何解决?
所有的按钮:
<a href="#" class="btn btn-xs btn-primary" data-toggle="popover">This opens popover</a>
<a href="#" class="btn btn-xs btn-primary">Other link</a> <- Doesn't work
<a href="#" class="btn btn-xs btn-primary">Other link</a> <- Doesn't work
z-index
,我觉得有些东西覆盖了弹出框。 - Rahil Wazir