Multiple fixed top navigation bars on Twitter. Is bootstrap 3 not working correctly?
html:
<div id="wrap">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand logo"></div>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="#">Item1</a>
</li>
<li class="divider-vertical"></li>
<li>
<a href="#about">Item2</a>
</li>
<li class="divider-vertical"></li>
<li>
<a href="#contact">Item3</a>
</li>
<li class="divider-vertical"></li>
<li>
<a href="#contact">Item4</a>
</li>
</ul>
</div>
</div>
</div>
<div class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".main-nav">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse main-nav">
<ul class="nav navbar-nav">
<li>
<a href="#">it1d</a>
</li>
<li class="divider-vertical"></li>
<li>
<a href="#about">it2d</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
<h1>HEllO</h1><br>
</div>
</div>
</div>
<!-- FOOTER -->
<div style="clear: both"></div>
CSS
body {
padding-top: 50px;
}
.navbar-static-top{
position: fixed;
right: 0;
left: 0;
z-index: 1000;background: #ccc;
}
Click here: http://www.bootply.com/101069
In the above code, I use two navigators, which I want to commit to the top of the page. The code works fine for desktops and laptops, but when they are visible on a mobile phone. the first navigation bar is the fix, and the second navigation bar is down. so what I need to do is to fix both the navigators at the top of both desktops and mobile phones. Any help would be appreciated ??
+4
1
navbar-static-top . navbar-fixed-top , . ( ) ( ), , : top:50px;
Bootply: http://www.bootply.com/Xd04ROsODx
+7