问答详情
源自:3-1 导航及下拉菜单制作

缩小屏幕后头部出现三个横杆点击后没有出现下拉菜单,代码看不出什么问题,能帮我看看吗

<!doctype html>
<html lang="zh-CH">
<head>

<!-- Required meta tags -->
<meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
   <title>现代浏览器博物馆</title>
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">


</head>
<body>

<nav class="navbar navbar-default" role="navigation">
   <div class="container">
       <div class="navbar-header">
           <button type="button" class="navbar-toggle collapsed" data-toggle="collaspe" data-target="#bs-example-navbar-collapse-1">
               <span class="sr-only">Toggle navigation</span>
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
           </button>
           <a class="navbar-brand" href="#">Brand</a>
       </div>
       <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
           <ul class="nav navbar-nav">
               <li class="active"><a href="#">Link</a> </li>
               <li><a href="#">Link</a> </li>
           </ul>
       </div>
   </div>
</nav>


<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js" ></script>
</body>
</html>

提问者:慕粉3867151 2017-11-16 16:12

个回答

  • qq_风迷离了眼_0
    2017-11-16 17:26:15

    button标签里面的data-toggle属性拼写错了,改成data-toggle="collapse",代码如下:

    <!doctype html>

    <html>

    <head>


    <!-- Required meta tags -->

    <meta charset="utf-8">

       <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

       <title>现代浏览器博物馆</title>

    <!-- Bootstrap CSS -->

    <link href="css/bootstrap.min.css" rel="stylesheet">

    </head>

    <body>

    <nav class="navbar navbar-default" role="navigation">

       <div>

    <div>

               <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">

                   <span>Toggle navigation</span>

                   <span></span>

                   <span></span>

                   <span></span>

               </button>

               <a href="#">Brand</a>

           </div>

           <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

               <ul class="nav navbar-nav">

                   <li><a href="#">Link</a> </li>

                   <li><a href="#">Link</a> </li>

               </ul>

           </div>

       </div>

    </nav>

    <script src="js/jquery-1.11.1.min.js"></script>

    <script src="js/bootstrap.min.js" ></script>

    </body>

    </html>