我在nav-collapse中有一个下拉菜单.
当我减小窗口的宽度(例如:700px)时,导航栏正确地折叠,然后我点击btn-navbar来解除它的折叠,然后我点击下拉列表,但它不会下拉,菜单不显示.如果然后我崩溃,再崩溃,下拉开始工作.
当窗口的宽度从一开始就很小时也会发生这种情况.
就像折叠部分的高度一开始就固定在一起,它不会让下拉菜单做到这一点.
<!DOCTYPE html> <html> <head> <Meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.css" /> <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap-responsive.css" /> <script src="js/jquery.js"></script> <script src="js/bootstrap.js"></script> </head> <body> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <!-- .btn-navbar is used as the toggle for collapsed navbar content --> <button class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <!-- Be sure to leave the brand out there if you want it shown --> <a class="brand" href="#">Project name</a> <!-- Everything you want hidden at 940px or less,place within here --> <div class="nav-collapse"> <ul class="nav pull-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Anonymous <b class="caret"></b> </a> <ul class="dropdown-menu"> <li> <a href=''><i class='icon-chevron-right'></i> Login</a> </li> <li> <a href=''><i class='icon-plus'></i> Register</a> </li> </ul> </li> </ul> </div> </div> </div> </div> </body> </html>
Bootstrap v2.2.0
Firefox 16.0.2
解决方法
很多人都将这报告作为回购的错误(例如
Issue #5671,Issue #5890,Issue #6019).
针对#5671,有人指出as per the docs on responsive Navbar,当使用类navbar-collapse时,您还必须包括崩溃.看来你的例子似乎也是这样(尽管容易被忽视)的缺陷.