mmenu:一个容器中有两个菜单

时间:2015-08-15 11:36:05

标签: jquery mmenu

是否可以在一个jQuery.mmenu-sliding容器中有两个菜单?在我的示例中,第二个导航被删除或隐藏。这可以改变吗?

标记看起来像这样:



<script>
$(document).ready(function(){
  $("#sidebar-offcanvas").mmenu({});
});
</script>
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery.mmenu/5.3.4/js/jquery.mmenu.min.all.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jQuery.mmenu/5.3.4/css/jquery.mmenu.min.css" rel="stylesheet"/>

<header>
    HEADER
</header>
<main>
    CONTENT
    <a href="#sidebar-offcanvas">Open the menu</a>

    <div id="sidebar-offcanvas">
        <div id="mainNavi">
            <nav>
                <ul role="menubar">
                    <li><a href="#">Main 1</a></li>
                    <li><a href="#">Main 2</a></li>
                    <li><a href="#">Main 3</a></li>
                </ul>
            </nav>
        </div><!-- /#mainNavi -->
        
        <div id="metaNavi">
            <nav>
                <ul role="menubar">
                    <li><a href="#">Meta 1</a></li>
                    <li><a href="#">Meta 2</a></li>
                    <li><a href="#">Meta 3</a></li>
                </ul>
            </nav>
        </div><!-- /#metaNavi -->
    </div><!-- /#sidebar-offcanvas -->
</main>

<footer>FOOTER</footer
&#13;
&#13;
&#13;

小提琴: http://jsfiddle.net/up7s9xyn/

1 个答案:

答案 0 :(得分:0)

自己找到答案:

两个菜单需要包装在一个容器中:

<div id="sidebar-offcanvas">
    <div class="wrapper">
        <div id="mainNavi">
            <nav>...</nav>
        </div>
        <div id="metaNavi">
            <nav>...</nav>
        </div>
    </div>
</div>

找到代码hier: http://jsfiddle.net/up7s9xyn/1/