我已经用一些自定义jquery的引导popover。 Popover功能工作正常,但如果我添加一个外部链接按钮,它不工作。请参阅代码:有两个用于弹出对话框的按钮“Button1”&“Button2”用于外部链接。Bootstrap:popover按钮链接不工作
$(document).ready(function() {
$("body").tooltip({
selector: "[data-toggle='tooltip']",
container: "body"
})
.popover({
selector: "[data-toggle='popover']",
container: "body",
html: true
});
});
$('body').on('click', function (e) {
$('[data-toggle="popover"]').each(function() {
if(!$(this).is(e.target) &&
$(this).has(e.target).length === 0 &&
$('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
});
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container" style="width:400px; height:400px; background:#000;padding-top:50px;">
<a data-placement="top" role="button" class="btn btn-danger" data-toggle="popover" data-content="Popover" data-original-title="" title="">
Button1
</a>
<a class="btn btn-danger" href="http://facebook.com" target="_blank">Button2</a>
</div>
你想酥料饼的出现,当你的用户去在它与自己的鼠标或链接后点击?因为我有最后的选择。 –
它按预期工作正常。我检查了我的本地。 – Samir
你需要在第二个按钮点击另一个URL?或者你想通过第二个按钮打开相同的弹出窗口?像第一个按钮? – Samir