源代码:
提交运行 »
<!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="http://www.fmpq.com/jscss/bootstrap/foundation.min.css"> <script src="http://www.fmpq.com/jscss/bootstrap/jquery.min.js"></script> <script src="http://www.fmpq.com/jscss/bootstrap/foundation.min.js"></script> <script src="http://www.fmpq.com/jscss/bootstrap/modernizr.js"></script> <style> [data-magellan-expedition], [data-magellan-expedition-clone] { padding: 0; } </style> </head> <body> <div data-magellan-expedition="fixed"> <nav class="top-bar" data-topbar> <ul class="title-area"> <li class="name"> <h1><a href="#">WebSiteName</a></h1> </li> <!-- 小屏幕上折叠按钮: 去掉 .menu-icon 类,可以去除图标。 如果需要只显示图片,可以删除 "Menu" 文本 --> <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li> </ul> <section class="top-bar-section"> <ul class="left"> <li data-magellan-arrival="page1"><a href="#page1">Page 1</a></li> <li data-magellan-arrival="page2"><a href="#page2">Page 2</a></li> </ul> </section> </nav> </div> <div style="padding:20px;height:1500px;"> <h3>Magellan 头部导航实例</h3> <p>向下滚动页面查看效果。</p> <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> </div> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
测试结果: