我正在创建一个bootstrap可折叠导航。看起来一切都设置正确。移动导航可以正常扩展,但崩溃无法正常工作。我已经检查过包含jquery和bootstrap文件,但是我被卡住了。有什么建议吗?
<!DOCTYPE HTML>
<html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="css/sixminutes.css" rel="stylesheet" />
<link rel="shortcut icon" href="favicon.ico">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-static-top" style="background-color:#E6E7E8; height:auto; overflow: hidden;border: none;">
<div class="container">
<div class="navbar-brand col-lg-4 col-md-4 col-sm-12 col-xs-12">
<a href="#">
<img class="img-responsive" src="images/logo.png" style="float:left; padding-left:30px; width: 100%; max-width: 500px;"></a>
</div>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="col-lg-8 col-md-8" style="padding-right: 50px; margin-top: 30px;">
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><h5 class="nav">ABOUT</h5></a></li>
<li><a href="#"><h5 class="nav">ARTICLES</h5></a></li>
<li><a href="#"><h5 class="nav">TESTIMONIALS</h5></a></li>
<li><a href="#"><h5 class="nav">JOIN</h5></a></li>
<li><a href=#"><h5 class="nav">CONTACT</h5></a></li>
</ul>
</div>
</div>
</div>
</div>
<!-- /header -->
答案 0 :(得分:1)
我不确定为什么你的导航栏品牌中有这些网格类“col-lg-4 col-md-4 col-sm-12 col-xs-12”,但它们是你代码中的问题:
试试这段代码:
<div class="navbar navbar-inverse navbar-static-top" style="background-color:#E6E7E8; height:auto; overflow: hidden;border: none;">
<div class="container">
<div class="navbar-brand col-lg-4 col-md-4 col-sm-12 col-xs-12">
<a href="#">
<img class="img-responsive" src="images/logo.png" style="float:left; padding-left:30px; width: 100%; max-width: 500px;"></a>
</div>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="col-lg-8 col-md-8" style="padding-right: 50px; margin-top: 30px;">
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><h5 class="nav">ABOUT</h5></a></li>
<li><a href="#"><h5 class="nav">ARTICLES</h5></a></li>
<li><a href="#"><h5 class="nav">TESTIMONIALS</h5></a></li>
<li><a href="#"><h5 class="nav">JOIN</h5></a></li>
<li><a href=#"><h5 class="nav">CONTACT</h5></a></li>
</ul>
</div>
</div>
</div>
</div>
这是一个jsFiddle Example