![7eadc76ace16224e73dd79e9c28180e4.png](https://i-blog.csdnimg.cn/blog_migrate/d7064769b0e54631a9154823b9addf47.jpeg)
Bootstrap popover 默认配置下,点击显示之后,需要再次点击触发的按钮才能隐藏。
中文官网的实例演示:https://v3.bootcss.com/javascript/#popovers
网站也给出了点击任意元素使其消失的参考:通过使用 focus
触发器可以在用户点击弹出框是让其消失。
<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">可消失的弹出框</a>
为了更好的跨浏览器和跨平台效果,你必须使用 <a> 标签,不能使用 <button> 标签,并且,还必须包含 role="button" 和 tabindex 属性。