Question

Right now I have edited my navbar css so that it always stays collapsed. My problem is that when I add too many links to it it kind of staggers midway while dropping down. Upon further inspection I have noticed that when I scrunch the browser window down and drop it down it actually collapses it into a sroll navbar sort of thing mid page. So essentially you end up scrolling it. I am lost on what setting to tweak so that it does not collapse it period. If anything, I want it to go full screen - When I drop it down it will just take up entire page. Here is the CSS override code:

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

My navbar partial code:

<nav 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="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
            <label class="navbar-brand" style="font-weight: normal" data-toggle="collapse" data-target=".navbar-collapse">Advising Center
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span></label>


    </div>
    <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav">
            <%= render 'layouts/navigation_links' %>
        </ul>
        <div class="navbar-header navbar-right">
    <p class="navbar-text">
    <ul><%=@currentuser.name%></ul>

    </p>
</div>
    </div>
</div>
</nav>

I have searched around for an answer but cannot seem to find it anywhere. Thank you for your help!

Était-ce utile?

La solution

To stop it from scrolling you need to override the max-width that Bootstrap sets:

.navbar-collapse {
  max-height: none;
}

Demo

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top