<!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>警告框</title> <meta name="renderer" content="webkit"> <meta http-equiv="Cache-Control" content="no-siteapp"/> <link rel="icon" type="image/png" href="assets/i/favicon.png"> <meta name="mobile-web-app-capable" content="yes"> <link rel="icon" sizes="192x192" href="assets/i/[email protected]"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-title" content="Amaze UI"/> <link rel="apple-touch-icon-precomposed" href="assets/i/[email protected]"> <meta name="msapplication-TileImage" content="assets/i/[email protected]"> <meta name="msapplication-TileColor" content="#0e90d2"> <link rel="stylesheet" href="assets/css/amazeui.min.css"> </head> <body style="margin: 20px;"> <!--基本形式--> <div class="am-alert"> 阅谁问君诵,水落清香浮。 </div> <!--关闭按钮--> <div class="am-alert" data-am-alert> <button type="button" class="am-close">×</button> <p>阅谁问君诵,水落清香浮。</p> </div> <!--不同状态--> <div class="am-alert am-alert-success" data-am-alert> <button type="button" class="am-close">×</button> <p>阅谁问君诵,水落清香浮。</p> </div> <div class="am-alert am-alert-warning" data-am-alert> <button type="button" class="am-close">×</button> <p>阅谁问君诵,水落清香浮。</p> </div> <div class="am-alert am-alert-danger" data-am-alert> <button type="button" class="am-close">×</button> <p>阅谁问君诵,水落清香浮。</p> </div> <div class="am-alert am-alert-secondary" data-am-alert> <button type="button" class="am-close">×</button> <p>阅谁问君诵,水落清香浮。</p> </div> <!--多内容--> <div class="am-alert" data-am-alert> <button type="button" class="am-close">×</button> <h3>涛声依旧</h3> <p>《涛声依旧》由陈小奇作词、作曲。这首歌曲的灵感来自唐诗《枫桥夜泊》。</p> <ul> <li>月落乌啼总是千年的风霜</li> <li>涛声依旧不见当初的夜晚</li> </ul> </div> <!--JS 控制示例--> <div class="am-alert" id="your-alert"> <button type="button" class="am-close">×</button> <p>在应用 JS 激活之前这个警告框是无法关闭的。不信点右边的 x 试试。</p> </div> <button type="button" class="am-btn am-btn-danger" id="doc-alert-btn-bind">点击激活上面 Alert 的关闭功能</button> <!--[if (gte IE 9)|!(IE)]><!--> <script src="assets/js/jquery.min.js"></script> <!--<![endif]--> <!--[if lte IE 8 ]> <script src="assets/ie8/jquery.min.js"></script> <script src="assets/ie8/modernizr.js"></script> <script src="assets/js/amazeui.ie8polyfill.min.js"></script> <![endif]--> <script src="assets/js/amazeui.min.js"></script> <script> $(function() { $('#doc-alert-btn-bind').one('click', function() { $('#your-alert').alert(); alert('已激活,点击上的 X 试试!'); }); }); </script> </body> </html>
效果图: