编辑下面的代码:【加编码】
<html> <head> <title>Bootstrap 实例 - 弹出框(Popover)插件事件</title> <link href="https://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> <script src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script src="https://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> </head> <body> <div clas="container" style="padding: 100px 50px 10px;"> <button type="button" class="btn btn-primary popover-show" title="Popover title" data-container="body" data-toggle="popover" data-content="左侧的 Popover 中的一些内容 —— show 方法"> 左侧的 Popover </button> </div> <script> $(function () { $('.popover-show').popover('show');}); $(function () { $('.popover-show').on('shown.bs.popover', function () { alert("当显示时警告消息"); })}); </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂