单击时,Bootstrap Navbar切换按钮不显示

时间:2016-06-07 18:38:54

标签: jquery html css twitter-bootstrap

以下是我刚刚开始研究的代码。出现在低宽度屏幕上的Navbar切换按钮不起作用。单击时,它的颜色会稍微改变,下拉导航不会出现。尝试将它与getboostrap.com中的Navbar示例进行比较,仍然没有运气。它是Nav代码中的问题吗?或者我把JS和CSS文件放错了顺序?请帮我解决这个问题。

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" 
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">

<nav class="navbar navbar-default navbar-inverse" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#example-nav-collapse" aria-expanded="false">
                <span class="sr-only">Toggle Navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a href="#" class="navbar-brand">Pico</a> 
        </div>

        <div class="collapse navbar-collapse" id="example-nav-collapse">
            <ul class="nav navbar-nav pull-right">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#">Docs</a></li>
                <li><a href="#">Download</a></li>
            </ul>
        </div>
    </div>
</nav>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" 
integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.2.min.js"></script>

2 个答案:

答案 0 :(得分:0)

您必须在Bootstrap.min.js

之前添加jQuery引用

答案 1 :(得分:0)

你需要在Bootstrap之前加载jQuery,如下所示:

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" 
integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>