当您向下滚动页面时,使用“navbar”和“navbar-fixed-top”类会使导航栏浮动在页面顶部。这似乎不适用于移动/ipad 浏览器。为什么以及如何让它们也漂浮在移动浏览器上。在 ipad(safari, chrome) Android(firefox) Windows Phone(IE) 上试过这个。
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap.js"></script>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<a 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>
</a>
<span class="brand"><img title="Logo" alt="Logo" src="static/images/iu_logo.gif" /></span>
<div class="nav-collapse">
<ul class="nav">
<li class="active">
<a id="homeLink" href="#">Home</a>
</li>
<li class="dropdown">
<a class="dropdown-toggle" id="newsLink" href="#">News</a>
<ul class="dropdown-menu">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li class="divider"></li>
<li><a href="#">Another link</a></li>
</ul>
</li>
</ul>
<ul class="nav pull-right">
<li id="loginLink"><a href="#" id="loginButton">Login</a></li>
</ul>
</div>
</div>
</div>
50 lines of text (just to have the page scrollable)
</body>
</html>
我确实在 head 标签中有以下行,以启用移动设备的引导响应。
<meta name="viewport" content="width=device-width, initial-scale=1.0">
有什么建议么