本文实例为大家分享了bootstrap警告框的具体代码,供大家参考,具体内容如下
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <title>XXX</title> <link rel="stylesheet" href="lib/bootstrap/css/bootstrap.css" rel="external nofollow" > <link rel="stylesheet" href="css/main.css" rel="external nofollow" > <!--[if lt IE 9]> <script src="lib/html5shiv/html5shiv.min.js"></script> <script src="lib/respond/respond.min.js"></script> <![endif]--> </head> <body> <div class="alert alert-danger fade in"><!--淡入淡出--> <button type="button" class="close" data-dismiss="alert"> <span>×</span> </button> <p> 警告:你的浏览器不支持 </p> </div> <br> <br> <br> <!--用jQuery代替data-dismiss="alert"--> <div class="alert alert-danger fade in" id="alert"><!--淡入淡出--> <button type="button" class="close"> <span>×</span> </button> <p> 警告:你的浏览器不支持 </p> </div> <script src="lib/jquery/jquery.js"></script> <script src="lib/bootstrap/js/bootstrap.js"></script> <script src="js/main.js"></script> <script> $('.close').on('click', function () { $('#alert').alert('close'); }) //事件,其他雷同 $('#alert').on('close.bs.alert', function () { alert('当 close 方法被触发时调用!'); }); </script> </body> </html>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持找一找教程网。