简单教程
提交运行
代码编辑器:
<!DOCTYPE html> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.bootcss.com/foundation/5.5.3/css/foundation.min.css"> <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/foundation/5.5.3/js/foundation.min.js"></script> <script src="https://cdn.bootcss.com/foundation/5.5.3/js/vendor/modernizr.js"></script> <nav class="top-bar" data-topbar data-options="is_hover: false"> <ul class="title-area"> <li class="name"> <h1><a href="#">WebSiteName</a></h1> </li> <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li> </ul> <section class="top-bar-section"> <ul class="left"> <li class="active"><a href="#">Home</a></li> <li class="has-dropdown"> <a href="#">Dropdown</a> <ul class="dropdown"> <li><a href="#">First link in dropdown</a></li> <li><a href="#">Second link in dropdown</a></li> <li class="active"><a href="#">Active link in dropdown</a></li> </ul> </li> </ul> </section> </nav> <div style="padding:20px;"> <h3>点击下拉菜单</h3> <p>默认情况下导航栏的下拉菜单在鼠标移动过去后显示,我们可以使用 <code>data-options="is_hover: false"</code> 属性来设置导航栏在鼠标在点击后显示</p> </div> <script> $(document).ready(function() {$(document).foundation();}) </script>
运行结果: