| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>遮罩层DEM</title> |
| |
| <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> |
| <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> |
| <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> |
| <style type="text/css"> |
| .loading { |
| background: #00000040 url(loader.gif) no-repeat center 50%; |
| z-index: 9999; |
| } |
| </style> |
| </head> |
| |
| <body> |
| <div class="container-fluid text-center"> |
| <h2>遮罩层DEMO</h2> |
| |
| <button onclick="startup()">遮罩层</button> |
| |
| <div class="modal fade loading" |
| id="myModal" |
| tabindex="-1" |
| role="dialog" |
| aria-labelledby="myModalLabel" |
| aria-hidden="true" |
| data-backdrop="static" |
| data-keyboard="false"> |
| // data-backdrop="static" data-keyboard="false" // 以上属性是静止掉了模态框的关闭按钮和点击空白处关闭模态框 |
| </div> |
| </div> |
| |
| <script> |
| function startup() { |
| $("#myModal").modal('show'); |
| setTimeout('shutdown()', 5000); |
| } |
| |
| function shutdown() { |
| $("#myModal").modal('hide'); |
| } |
| </script> |
| </body> |
| </html> |