Bootstrap Nav Disappears On Resize
I have a Bootstrap 3 navbar. When I scale the browser window to a low resolution or access the page with my mobile I have no menu. Usually, with Bootstrap I have a collapsed naviga
Solution 1:
It isn't clear in your question but your missing the toggle button to open and close the menu when your viewport is reduced, otherwise the mobile menu will always be open.
nav.navbar-default {
background: #333E48;
border: 0;
}
.navbar-default.navbar-brand > img,
.navbar-default.navbar-brand {
padding: 0px;
margin: 0;
}
.navbar-default.navbar-brand > img {
padding: 4px;
height: 50px;
margin: auto;
vertical-align: middle;
display: inline-block;
}
.navbar-default.navbar-brand,
.navbar-default.navbar-navlia {
line-height: 90px;
height: 90px;
padding-top: 0px;
}
.navbar-default.nav-collapse.collapse {
height: auto !important;
/* From Stack Overflow */overflow: visible !important;
/* From Stack Overflow */
}
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkhref="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"rel="stylesheet" /><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script><navclass="navbar navbar-default navbar-fixed-top"><divclass="container"><divclass="navbar-header"><buttontype="button"class="navbar-toggle collapsed"data-toggle="collapse"data-target="#bs-collapse"aria-expanded="false"><spanclass="sr-only">Toggle navigation</span><spanclass="icon-bar"></span><spanclass="icon-bar"></span><spanclass="icon-bar"></span></button><aclass="navbar-brand"href="index.php"><imgsrc="http://placehold.it/100x50/fff/fff" /></a></div><divclass="collapse navbar-collapse"id="bs-collapse"><ulclass="nav navbar-nav navbar-right"><li><ahref="index.php">Home</a></li><liclass="aktiv"><ahref="advertiser.php">Advertisers</a></li><li><ahref="publisher.php">Publishers</a></li><li><ahref="#"data-toggle="modal"data-target="#aboutModal">About</a></li><li><ahref="#"data-toggle="modal"data-target="#pressModal">Press</a></li></ul></div></div></nav>
Solution 2:
Just have to remove the collapse
class on div#navbar
Here is a fiddle
<nav class="navbar navbar-default navbar-fixed-top">
<divclass="container"><divclass="navbar-header"><aclass="navbar-brand"href="index.php"><imgsrc="images/logo.png"></a></div><divid="navbar"class="navbar-collapse"><ulclass="nav navbar-nav navbar-right"><li><ahref="index.php">Home</a></li><liclass="aktiv" ><ahref="advertiser.php">Advertisers</a></li><li><ahref="publisher.php">Publishers</a></li><li><ahref="#"data-toggle="modal"data-target="#aboutModal">About</a></li><li><ahref="#"data-toggle="modal"data-target="#pressModal">Press</a></li></ul></div></div></nav>
And rewrite the css for the xs view
Post a Comment for "Bootstrap Nav Disappears On Resize"