导航子菜单

时间:2014-03-22 09:43:07

标签: jquery submenu

我想问一下如何使用jQuery做这个子菜单?

例如我的菜单代码

<div class="menu">
<ul class="nav nav-pills">
<li class="divider"><a href="#">Our Company</a></li>
<li class="divider"><a href="#">Products</a></li>
<li class="divider"><a href="#">Contact Us</a></li>
<li><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
</ul>
</div>

和我的子菜单代码:

 <div class="submenu">
   <ul class="nav nav-pills">
    <li class="divider-point"><a href="#">ATC</a></li>
    <li class="divider-point"><a href="#">Radars</a></li>
    <li class="divider-point"><a href="#"> Components </a></li>
   </ul>
   </div>

最终结果应该是这样的:

http://media.smashingmagazine.com/wp-content/uploads/images/60-more-css-techniques/117.jpg

1 个答案:

答案 0 :(得分:2)

function subMenu(show) {
    if (show){
      document.getElementById('sub_menu').style.display = 'block';
    } else {
      document.getElementById('sub_menu').style.display = 'none';
    }
}