所以我有这部分代码应该是我的部分工作,目的是制作一个功能索引页面,但是我编写了这段代码,但是找不到菜单键拒绝激活下拉列表的时间点。我在Chrome / Firefox上尝试过这个问题并且两者都有问题,但我找不到确切的问题。
非常感谢指导。
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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="#">Ristorante Con Fusion</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#"><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Home</a>
</li>
<li><a href="#">About</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
Menu <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Appetizers</a>
</li>
<li><a href="#">Main Courses</a>
</li>
<li><a href="#">Desserts</a>
</li>
<li><a href="#">Drinks</a>
</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Specials</li>
<li><a href="#">Lunch Buffet</a>
</li>
<li><a href="#">Weekend Brunch</a>
</li>
</ul>
</li>
<li><a href="#">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
答案 0 :(得分:0)
确保您已包含所有Bootstrap的javascript文件:
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
答案 1 :(得分:0)
添加外部文件。详细信息在Snippet中
/* Changes
line 1
|| Added external link to Bootstrap.css file
=======================
line 47
|| Added external jQuery script file
=======================
line 49
|| Added external Bootstrap.js script file
*/
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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="#">Ristorante Con Fusion</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#"><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Home</a>
</li>
<li><a href="#">About</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
Menu <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Appetizers</a>
</li>
<li><a href="#">Main Courses</a>
</li>
<li><a href="#">Desserts</a>
</li>
<li><a href="#">Drinks</a>
</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header">Specials</li>
<li><a href="#">Lunch Buffet</a>
</li>
<li><a href="#">Weekend Brunch</a>
</li>
</ul>
</li>
<li><a href="#">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>