简体   繁体   中英

Twitter Bootstrap Collapse not collapsing

I'm trying to use the bootstrap collapse navbar, I can expanded but I can't collapse the navigation.

And I can't find anything wrong with it:

    <nav class="navbar navbar-inverse nav-justified">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#nav-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="collapse navbar-collapse" id="nav-collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="http://revad.dev/news/">News</a>
                </li>
            </ul>
            <ul id="menu-menu" class=" nav navbar-nav">
                <li id="menu-item-5" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-5"><a href="http://revad.dev/">Accueil</a>
                </li>
                <li id="menu-item-290" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-290"><a href="http://revad.dev/#le-projet">Le Projet</a>
                </li>
                <li id="menu-item-291" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-291"><a href="http://revad.dev/#partenaires">Partenaires</a>
                </li>
                <li id="menu-item-292" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-292"><a href="http://revad.dev/#lavenir-du-projet">L&rsquo;avenir</a>
                </li>
                <li id="menu-item-293" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-293"><a href="http://revad.dev/#contact">Contact</a>
                </li>
            </ul>
        </div>
    </nav>

Was just using Bootstrap v3 CSS but v2 JS.

Updated javascript files to v3 and it worked all fine.

Thanks for your help

It appears that you have a few classes called current_* . If you have multiple active classes the collapse function would not work since it needs one or a sub set of items to activate and deactivate. Making sure that items are only active when they should be will ensure that bootstrap's jquery can select and hide the appropriate items .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM