简体   繁体   中英

Toggle button on navbar doesn't work - Twitter Bootstrap 3.2

I'm using Twitter Bootstrap 3.2 and the button on the right side on the navbar doesn't work when I click on it.

Here's my Code:

<!-- HEADER -->        
<nav class="navbar navbar-inverse custom" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" 
                    data-toggle="collapse" 
                    data-target=".bs-example-navbar-collapse-1">                    
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html"><img src="images/LynxusLogo.png" /></a>
        </div>            

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-right">                        
                <li><a href="#"><img src="images/Home.png" onmouseover="hoverHome(this);" onmouseout="unhoverHome(this);"/></a></li>
                <li><a href="#"><img src="images/About.png" onmouseover="hoverAbout(this);" onmouseout="unhoverAbout(this);"/></a></li>
                <li><a href="#"><img src="images/Team.png" onmouseover="hoverTeam(this);" onmouseout="unhoverTeam(this);"/></a></li>
                <li><a href="http://lynxusapp.blogspot.com/" target="_blank"><img src="images/Blog.png" onmouseover="hoverBlog(this);" onmouseout="unhoverBlog(this);"/></a></li>
                <li><a href="#"><img src="images/Contact.png" onmouseover="hoverContact(this);" onmouseout="unhoverContact(this);"/></a></li>
            </ul>                    
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

Change the data-target on the button to use the id ( # ) instead of the class( . ) selector

data-target="#bs-example-navbar-collapse-1"

Demo in Fiddle

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