我正面临twitter bootstrap下拉菜单的问题,我需要帮助来解决问题。我是一个非常初学者使用bootstrap。在此先感谢您的帮助。
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
<script src="js/jquery-1.10.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-dropdown.js"></script>
<div class="container">
<div class="row">
<div class="span12">
<nav class="navbar">
<div class="navbar-inner">
<a href="#" class="brand">brand</a>
<ul class="nav">
<li><a href="home.php">Home</a></li>
<li><a href="home.php">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">connect
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="#">home</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
答案 0 :(得分:0)
将application.js
文件附加到头部的js声明中......就您声明bootstrap.min.js
和bootstrap-dropdown.js
而言,bootstrap.min.js
具有所有元素j的js twitter bootstrap的JavaScript权限,因此需要附加bootstrap-dropdown.js
...
还使用jquery最新版本的代码......
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/application.js"></script>
这是你的工作演示: - http://jsfiddle.net/eGLMm/
...谢谢
答案 1 :(得分:0)
在关闭标题之前使用此标记
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.min.css">
然后是html部分
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-inverse-collapse">
<span class="icon-bar"> </span>
<span class="icon-bar"> </span>
<span class="icon-bar"> </span>
</a>
<a href="pages/" class="brand"> Expense Manager</a>
<div class="nav-collapse collapse navbar-inverse-collapse">
<ul class="nav ">
<li class="dropdown "> <a href="users" class="dropdown-toggle" data-toggle="dropdown"> Users <i class="caret"> </i> </a>
<ul class="dropdown-menu mydropdown">
<li> <a href="users/add" class="linkmain"> Add Users </a> </li>
<li> <a href="users/" class="linkmain"> Manage Users </a> </li>
</ul>
</li>
<li class="dropdown "><a href="users" class="dropdown-toggle" data-toggle="dropdown"> Users <i class="caret"> </i> </a>
<ul class="dropdown-menu mydropdown">
<li> <a href="users/add" class="linkmain"> Add Notes </a> </li>
<li> <a href="users/" class="linkmain"> Manage Notes </a> </li>
</ul>
</li>
</ul>
<ul class="nav pull-right">
<li class="active"> <a href="users/login"> Login to add your expense </a></li>
</ul>
</div>
</div>
</div>
</div>