好吧,所以我已经阅读了很多关于此问题的帖子,而不是帮助我解决了我面临的最重要问题。问题是我已经建立了一个引导菜单,最基本的菜单来自getbootstrap.com。老实说,我不明白我做错了什么,并遵循了我在加载bootstrap.js之前加载jQuery.js的建议。 Here is a link to a jsfiddle of the problem
这里有完整的代码我用于我正在尝试使用的页面。
<!DOCTYPE html>
<html>
<head>
<title>WITHELD</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<script rel="javascript" style="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script rel="javascript" style="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="ext/style.css">
<script rel="javascript" type="text/javascript" src="ext/script.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<a href="#">
<img src="ext/img/head.jpg" style="max-height:100px;">
</a>
</div>
<div class="col-md-2">
</div>
</div><!--/.row/ Head-->
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle group -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="collapsemen" aria-expanded="false">
<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>
<!-- Collect Nav links, forms and other content. -->
<div class="collapse navbar-collapse" id="collapsemen">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only"></span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-hashpopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Blacktion</a></li>
<li><a href="#">Seperated</a></li>
<li role="separator" class="divider"></li>
<li><a href="boop!"></a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</div><!--/.Container-fluid/ Content wrapper.-->
</body>
</html>
答案 0 :(得分:1)
updted fiddle
您忘记将#
添加到数据目标属性。
工作代码段
<!DOCTYPE html>
<html>
<head>
<title>Din Socialjurist</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<script rel="javascript" style="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script rel="javascript" style="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="ext/style.css">
<script rel="javascript" type="text/javascript" src="ext/script.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<a href="#">
<img src="ext/img/head.jpg" style="max-height:100px;">
</a>
</div>
<div class="col-md-2">
</div>
</div><!--/.row/ Head-->
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle group -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapsemen" aria-expanded="false">
<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>
<!-- Collect Nav links, forms and other content. -->
<div class="collapse navbar-collapse" id="collapsemen">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only"></span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-hashpopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Blacktion</a></li>
<li><a href="#">Seperated</a></li>
<li role="separator" class="divider"></li>
<li><a href="boop!"></a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</div><!--/.Container-fluid/ Content wrapper.-->
</body>
</html>