With bootstrap, I'm creating a two level Navbar, and I want the top part, the dark blue one, to stay fixed when scrolling, but when I give .navbar-default .navbar-collapse a position:fixed, the middle part gets chopped off. Any idea of why this happens and how I could fix it?
This is my code:
<header id="header">
<nav class="navbar navbar-default hidden-sm hidden-xs" role="navigation">
<div class="navbar-collapse navbar-azul">
<ul class="nav navbar-nav navbar-left navbar-azul">
<li class="uppercase"><a href="#">One</a></li>
<li class="uppercase"><a href="#">Two</a></li>
<li class="uppercase"><a href="#">Three</a></li>
<li class="uppercase"><a href="#">Four</a></li>
</ul>
<ul class="nav navbar-nav navbar-right navbar-azul">
<li class="white"><a href="#" target="_blank" class="nav-facebook" style="padding-left: 5px; padding-right: 5px;"><i class="fa fa-facebook" ></i></a></li>
<li><a href="#" target="_blank" class="nav-twitter" style="padding-left: 5px; padding-right: 5px;"><i class="fa fa-twitter" ></i></a></li>
<li><a href="#" target="_blank" class="nav-instagram" style="padding-left: 5px; padding-right: 5px;"><i class="fa fa-instagram"></i></a></li>
<li><a href="#" target="_blank"class="nav-youtube" style="padding-left: 5px; padding-right: 0;"><i class="fa fa-youtube-play"></i></a></li>
<li><a href="#" target="_blank" class="nav-video" style="padding-left: 5px;"><i class="fa fa-play-circle-o"></i>Videos</a>
</li>
<li><a href="#" target="_blank"><i class="fa fa-television"></i>Shows</a>
</li>
</ul>
</div>
</nav>
<div class="navbar navbar-inverse" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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.html">
<h1><img src="images/logo.png" class="logohead img-responsive" alt="logo"></h1>
</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left navbar-celeste-text">
<li><a href="#">Menu 1</a></li>
<li><a href="#">Menu 2</a></li>
<li class="dropdown "><a href="#">Menu 3 <i class="fa fa-angle-down"></i></a>
<ul role="menu" class="sub-menu">
<li><a href="#">One</a></li>
<li><a href="#">Two</a></li>
<li><a href="#">Three</a></li>
</ul>
</li>
<li><a href="#">Menu 3</a></li>
<!-- <li><a href="#">Antigua Sports</a></li> -->
<li><a href="#">Menu 4</a></li>
<li class="uppercase visible-sm-block visible-xs-block"><a href="#">One Small Screen</a></li>
<li class="uppercase visible-sm-block visible-xs-block"><a href="#">Two Small Screen</a></li>
<li class="uppercase visible-sm-block visible-xs-block"><a href="#">Three Small Screen</a></li>
<li class="uppercase visible-sm-block visible-xs-block"><a href="#">Four Small Screen</a></li>
<li class="visible-sm-block visible-xs-block"><a href="#"><i class="fa fa-play-circle-o"></i>Videos</a></li>
<li class="visible-sm-block visible-xs-block"><a href="#"><i class="fa fa-television"></i>Shows</a></li>
<li class="visible-sm-block visible-xs-block">
<div class="search">
<form role="form">
<i class="fa fa-search"></i>
<div class="field-toggle">
<input type="text" class="search-form" autocomplete="off" placeholder="Search">
</div>
</form>
</div>
</li>
</ul>
</div>
<div class="search hidden-sm hidden-xs">
<form role="form">
<i class="fa fa-search"></i>
<div class="field-toggle">
<input type="text" class="search-form" autocomplete="off" placeholder="Search">
</div>
</form>
</div>
</div>
</div>
And the CSS:
#header{
margin-bottom: 0;
padding: 0 0 30px 0;
margin: 0 auto;
width:100%;
z-index:999;
background:#00b1ec;
}
#header .navbar-inverse .container{
position: relative;
}
.pull-right {
right:50px;
position:absolute;
top:15px
}
#header .navbar {
border: 0;
margin-bottom: 0;
}
#header .navbar-toggle{
margin-top: 20px;
}
#header .navbar-brand{
padding: 0;
margin-left: 0;
}
#header .navbar-brand h1{
padding: 0;
margin: 0;
}
#header .navbar-nav.navbar-left >li:last-child{
margin-left: 20px;
}
#header .navbar-nav.navbar-left >li a {
color: #fff;
font-weight: 400;
}
.navbar-default .navbar-collapse {
position: fixed;
z-index: 999;
}
.navbar-default .navbar-collapse, .navbar-inverse .navbar-nav>li>a {
color: #fff;
}
.navbar-azul-text {
color: #fff;
font-size: 14px;
}
.navbar-celeste-text{
color: #fff;
font-size: 18px;
}
.navbar-default .navbar-nav>li>a{
color:#fff;
}
#header .navbar-inverse .navbar-nav li.active > a,
#header .navbar-inverse .navbar-nav li.active > a:focus,
#header .navbar-nav.navbar-left li > a:hover,
.navbar-inverse .navbar-nav > .open > a,
.navbar-default .navbar-nav>li>a:focus,
.navbar-default .navbar-nav>li>a:hover {
background-color: inherit;
border: 0;
color: #E61F47;
}
Aucun commentaire:
Enregistrer un commentaire