你好,我創建了一個新的引導網站,由於某種原因下拉菜單將無法正常工作。當我點擊它時,它什麼都不做。Bootstrap下拉菜單不工作?
下面是代碼我在我的index.php文件體:
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar1">
<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="index.php">CookieCodec</a>
</div>
<div class="collapse navbar-collapse" id="navbar1">
<ul class="nav navbar-nav navbar-right">
<?php if (isset($_SESSION['usr_id'])) { ?>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" href="#"><span class="glyphicon glyphicon-user"></span> Signed in as <?php echo $_SESSION['usr_name']; ?></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">My Profile</a></li>
<li><a href="#">Upload</a></li>
<li><a href="#">Account</a></li>
</ul>
</li>
<li><a href="logout.php"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
<?php } else { ?>
<li><a href="login.php">Login</a></li>
<li><a href="register.php">Sign Up</a></li>
<?php } ?>
</ul>
</div>
</div>
</nav>
有誰知道爲什麼它不會工作?我錯過了什麼嗎?
你已包括在文件中的bootstrap.js文件? – Katie
HTML很好。你只需要'bootstrap.min.js'文件 - 檢查這個[工作codepen](http://codepen.io/PleaseBugMeNot/pen/LRdozR) - 從這裏得到它https://maxcdn.bootstrapcdn.com/ bootstrap/3.3.7/js/bootstrap.min.js –
謝謝您的輸入! – user5947524