bootstrap 导航栏崩溃不起作用,其他问题的答案也不起作用
bootstrap navbar collapse not fuctioning and the answers on other questions didn't work
我正在尝试使用 bootstrap 制作一个可折叠的导航栏,导航栏确实折叠了但是当我点击它时它没有下拉列表这是我索引 html 页面中的所有代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Honk</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="public/stylesheets/styles.css">
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="public/stylesheets/custom.css">
</head>
<body>
<nav class="navbar navbar-fixed-top navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img class="logo" src="public/images/honklogoo.png" alt="">
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a class="discrip" href="#">About</a></li>
<li><a href="#">Commuters</a></li>
<li><a href="#">Travelers</a></li>
<li><a href="#">On Demand</a></li>
<li><a href="#">Safety</a></li>
<li><a href="#">Download</a></li>
</ul>
</div>
</div>
</nav>
</body>
</html>
您的 html 中没有 bootstrap js 脚本(您只有 css)
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
它在这里工作:http://jsfiddle.net/swm53ran/26/
顺便说一句,确保将它放在 jquery 脚本之后,因为 bootstrap 依赖于 jquery
我正在尝试使用 bootstrap 制作一个可折叠的导航栏,导航栏确实折叠了但是当我点击它时它没有下拉列表这是我索引 html 页面中的所有代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Honk</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="public/stylesheets/styles.css">
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="public/stylesheets/custom.css">
</head>
<body>
<nav class="navbar navbar-fixed-top navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img class="logo" src="public/images/honklogoo.png" alt="">
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a class="discrip" href="#">About</a></li>
<li><a href="#">Commuters</a></li>
<li><a href="#">Travelers</a></li>
<li><a href="#">On Demand</a></li>
<li><a href="#">Safety</a></li>
<li><a href="#">Download</a></li>
</ul>
</div>
</div>
</nav>
</body>
</html>
您的 html 中没有 bootstrap js 脚本(您只有 css)
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
它在这里工作:http://jsfiddle.net/swm53ran/26/
顺便说一句,确保将它放在 jquery 脚本之后,因为 bootstrap 依赖于 jquery