导航栏上的切换按钮不起作用 - Twitter Bootstrap 3.2

时间:2014-07-02 19:53:08

标签: jquery html css twitter-bootstrap twitter-bootstrap-3

我正在使用Twitter Bootstrap 3.2,当我点击它时,导航栏右侧的按钮不起作用。

这是我的代码:

<!-- 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>

1 个答案:

答案 0 :(得分:1)

更改按钮上的data-target以使用ID(#)而不是类(.)选择器

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

Demo in Fiddle