源代碼
點擊運行
<!DOCTYPE html> <html> <head> <title>Foundation 實例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.staticfile.org/foundation/5.5.3/css/foundation.min.css"> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/foundation/5.5.3/js/foundation.min.js"></script> <script src="https://cdn.staticfile.org/foundation/5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div style="padding:20px;"> <h2>內嵌模態框</h2> <!-- 觸發模態框 --> <button type="button" class="button" data-reveal-id="myModal">點擊打開模態框</button> <!-- 第一個模態框 --> <div id="myModal" class="reveal-modal" data-reveal> <h2>第一個模態框</h2> <p>點擊以下按鈕會打開一個新的模態框。如果打開新的模態框,那么第一個模態框就會被關閉。</p> <p><a href="#" data-reveal-id="secondModal" class="button success" style="text-decoration:none;">打開第二個模態框</a></p> <a class="close-reveal-modal">×</a> </div> <!-- 第二個模態框 --> <div id="secondModal" class="reveal-modal" data-reveal data-options="multiple_opened:true;"> <h2>第二個模態框</h2> <p>第二個模態框,第一個模態在第二個模態框下面,併沒有關閉。</p> <a class="close-reveal-modal">×</a> </div> </div> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
運行結果