How to make a 3-level collapsing menu in Bootstrap?

前端 未结 2 825
星月不相逢
星月不相逢 2021-02-04 01:12

I am trying to make a 3-level collapsing navbar menu for Bootstrap, but I can\'t open the third level.

This is the two level menu which I have:

相关标签:
2条回答
  • 2021-02-04 01:40

    Bootstrap 3 dropped native support for nested collapsing menus, but there's a way to re-enable it with a 3rd party script. It's called SmartMenus. It means adding three new resources to your page, but it seamlessly supports Bootstrap 3.x with multiple levels of menus for nested <ul>/<li> elements with class="dropdown-menu". It automatically displays the proper caret indicator as well.

    <head>
       ...
       <script src=".../jquery.smartmenus.min.js"></script>
       <script src=".../jquery.smartmenus.bootstrap.min.js"></script>
       ...
       <link rel="stylesheet" href=".../jquery.smartmenus.bootstrap.min.css"/>
       ...
    </head>
    

    Here's a demo page: http://vadikom.github.io/smartmenus/src/demo/bootstrap-navbar-fixed-top.html

    0 讨论(0)
  • 2021-02-04 01:44

    Bootstrap 2.3.x and later supports the dropdown-submenu..

    <ul class="dropdown-menu">
                <li><a href="#">Login</a></li>
                <li class="dropdown-submenu">
                    <a tabindex="-1" href="#">More options</a>
                    <ul class="dropdown-menu">
                        <li><a tabindex="-1" href="#">Second level</a></li>
                        <li><a href="#">Second level</a></li>
                        <li><a href="#">Second level</a></li>
                    </ul>
                </li>
                <li><a href="#">Logout</a></li>
    </ul>
    

    Working demo on Bootply.com

    0 讨论(0)
提交回复
热议问题