viko viko - 2 months ago 50
CSS Question

Bootstrap navbar-toggle alway open

I would like to button (navbar-toggle ) was visible at any time I tested: http://jsfiddle.net/KyleMit/m49Bb/ and it works 50/50. Button is all time. If I click button menu pops up at a moments and disappears.

Maybe more understandable:
1. Click on the button.
2. See menu for 2s.
3. Again, you don't see the menu.

I used Bootstrap v3.3.4

<nav class="navbar navbar-default navbar-static-top always-open" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar" aria-controls="navbar">
<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="#">{{projectTitle()}}</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
{{ menu() | raw}}
</div><!--/.nav-collapse -->
</div>
</nav>


CSS

.navbar.always-open {
border-radius: 0;
}
.navbar.always-open .navbar-header {
float: none;
}
.navbar.always-open .navbar-toggle {
display: block;
}
.navbar.always-open .navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar.always-open .navbar-collapse.collapse {
display: none!important;
}
.navbar.always-open .navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar.always-open .navbar-nav>li {
float: none;
}
.navbar.always-open .navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}

Answer

in bootstrap.css choose:

.navbar-collapse.collapse{
  height:auto!important;
  padding-bottom:0;
  overflow:visible!important
}

(delete display: block !important) and in my css:

.navbar.always-open .navbar-collapse.collapse {
  display: none;
}
.navbar.always-open .navbar-collapse.in {
  display: block;
}