2016-03-15 132 views
1

我有一個問題得到的可摺疊導航欄加載在頁面上 - 當您縮小屏幕時出現按鈕,但是當我點擊它時,什麼也沒有發生。請幫助。Bootstrap導航欄收縮不工作

以下是我的HTML:

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> 
 
    <!--[if lt IE 9]> 
 
     <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> 
 
     <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> 
 
    <![endif]--> 
 
    
 
    <title>@ViewBag.Title - OTANI TIRE CO., LTD.</title> 
 
    <link href="@Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" /> 
 
    <script src="@Url.Content("~/Scripts/jquery")"></script> 
 
    <script src="@Url.Content("~/Scripts/bootstrap")"></script>  
 
</head> 
 
<body> 
 
    <div class="navbar navbar-default navbar-fixed-top"> 
 
     <div class="container"> 
 
      <div class="navbar-header"> 
 
       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> 
 
        <span class="sr-only">Toggle navigation</span> 
 
        <span class="icon-bar"></span> 
 
        <span class="icon-bar"></span> 
 
        <span class="icon-bar"></span> 
 
       </button> 
 
       <ul class="nav navbar-nav"> 
 
        <li> 
 
         <a href="@Url.Action("Index", "Home")" title="Index" class="links"> 
 
          <img alt="Index" src="@Url.Content("~/Content/Logo-Otani-3D_H2.png")"> 
 
         </a> 
 
        </li> 
 
       </ul> 
 
      </div> 
 
      <div class="collapse navbar-collapse"> 
 
       <ul class="nav navbar-nav navbar-right">      
 
        <li>@Html.ActionLink("Home", "Index", "Home")</li> 
 
        <li>@Html.ActionLink("New Arrivals", "NewArrivals", "Home")</li> 
 
        <li>@Html.ActionLink("Brochure", "Brochure1", "Home")</li>        <li>@Html.ActionLink("Awards", "Awards", "Home")</li> 
 
        <li>@Html.ActionLink("Contact", "Contact", "Home")</li> 
 
       </ul> 
 
      </div> 
 
     </div> 
 
    </div> 
 
    <div class="container body-content"> 
 
     @RenderBody() 
 
     <br> 
 
     <br> 
 
     <br> 
 
     <br> 
 
     <hr /> 
 
     <footer> 
 
      <p>&copy; @DateTime.Now.Year - OTANI TIRE CO., LTD. - ALL RIGHTS RESERVED.</p> 
 
     </footer> 
 
    </div> 
 
    <script src="Scripts/jquery-1.10.2.js"></script> 
 
    <script src="Scripts/bootstrap.js"></script> 
 
</body> 
 
</html>

+0

你忘了包括.css和.js嗎? – silviagreen

+0

你可以把你的代碼放到一個複製問題的小提琴嗎? https://jsfiddle.net/ – Jay

回答

0

第一類navbar-brand添加到您的標誌。它的跨度擋住下拉按鈕

<a href="@Url.Action("Index", "Home")" title="Index" class="links navbar-brand"> 
    <img alt="Index" src="@Url.Content("~/Content/Logo-Otani-3D_H2.png")"> 
</a> 

,並確保你的JavaScript文件被加載

細節這裏https://plnkr.co/edit/J8XEdyzVvtCIoguNOLVc