<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="width=device-width, initial-scale=1, user-scalable=no"> <title>XXX</title> <link href="https://www.jb51.net/lib/bootstrap/css/bootstrap.css" > <link href="https://www.jb51.net/css/main.css" > <!--[if lt IE 9]> <script src="https://www.jb51.net/lib/html5shiv/html5shiv.min.js"></script> <script src="https://www.jb51.net/lib/respond/respond.min.js"></script> <![endif]--> </head> <body> <div><!--淡入淡出--> <button type="button" data-dismiss="alert"> <span>×</span> </button> <p> 警告:你的浏览器不支持 </p> </div> <br> <br> <br> <!--用jQuery代替data-dismiss="alert"--> <div><!--淡入淡出--> <button type="button"> <span>×</span> </button> <p> 警告:你的浏览器不支持 </p> </div> <script src="https://www.jb51.net/lib/jquery/jquery.js"></script> <script src="https://www.jb51.net/lib/bootstrap/js/bootstrap.js"></script> <script src="https://www.jb51.net/js/main.js"></script> <script> $('.close').on('click', function () { $('#alert').alert('close'); }) //事件,其他雷同 $('#alert').on('close.bs.alert', function () { alert('当 close 方法被触发时调用!'); }); </script> </body> </html>
bootstrap警告框示例代码分享
内容版权声明:除非注明,否则皆为本站原创文章。