源代碼
點擊運行
<!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 style="height:1500px;padding:20px;"> <h3>Magellan Options</h3> <h5 class="subheader"> <code>threshold</code> 選項指定導航在什么時候需要固定位置。會根據滾動條滾動計算,默認為 0 (auto)。該實例中我們設置為 100:</h5> <hr> <div data-magellan-expedition="fixed" data-options="threshold:100"> <dl class="sub-nav"> <dd data-magellan-arrival="page1"><a href="#page1">Page 1</a></dd> <dd data-magellan-arrival="page2"><a href="#page2">Page 2</a></dd> </dl> </div> <hr> <div style="height:200px;background-color:#1abc9c;color:white;"> <h3 data-magellan-destination="page1">Page1</h3> <a name="page1"></a> <p>滾動屏幕,查看導航欄上的變化。</p> </div> <h3 data-magellan-destination="page2">Page2</h3> <a name="page2"></a> <p>滾動屏幕,查看導航欄上的變化。併嘗試向上滾動。</p> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
運行結果