林做了以下酥料饼: https://jsfiddle.net/ca4h0a0q/引导酥料饼,关闭按钮
<a class='danger' data-placement='above' title="Popover Title" href='#'>Click</a>
<div id="popover_content_wrapper" style="display: none">
<button class="close">
x
</button>
<div>This is your div content</div>
</div>
的Javascript:
$(document).ready(function(){
$("body").on("click",".close",function(){
$(".danger").trigger("click");
});
$('.danger').popover({
html : true,
content: function() {
return $('#popover_content_wrapper').html();
}
});
});
为了闭合酥料饼的,由于这个错误:https://github.com/twbs/bootstrap/issues/16732我不得不触发click事件在打开它的按钮上。我不太喜欢这个解决方案。还有更好的方法吗?
检查这个问题,有各种方式来添加关闭按钮酥料饼讲到这里,https://stackoverflow.com/questions/ 13413057/How-to-insert-close-button-in-popover-for-bootstrap – azs06