Bootstrap 3.0.0 nav vertical collapse responsive

David-IT picture David-IT · Sep 20, 2013 · Viewed 68.2k times · Source

After many search without results, I try to send a post.

I'm looking for a way for the nav-stacked (vertical menu) from bootstrap 3.0.0 (http://getbootstrap.com/components/#nav-pills) or my sidebare becomes collapsed when tablet or smartphone is used (such as navbar).

I'm agree to use other component that nav-stacked if the result is a vertical responsive menu.

My code

         <div class="col-md-2">
            <div class="panel panel-default" id="sidebar" >
            <div class="panel-heading" style="background-color:#888;color:#fff;" data-target="#test">Sidebar</div> 
            <div class="panel-body" id="test">
            <ul class="nav nav-stacked nav-collapse">
                <li><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>

            </ul>

              <hr>

            <div class="col col-span-12">
              <i class="icon-2x icon-facebook"></i>&nbsp;
              <i class="icon-2x icon-twitter"></i>&nbsp;
              <i class="icon-2x icon-linkedin"></i>&nbsp;
              <i class="icon-2x icon-pinterest"></i>
            </div>

            </div><!--/panel body-->
          </div><!--/panel-->
        </div><!--/end left column-->

Thank you in advance for your help :-)

Answer

Deja Vu picture Deja Vu · Sep 21, 2013

Is that it ?

<div class="col-md-2">
    <nav class="navbar navbar-default" role="navigation">

        <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>

        <div class="collapse navbar-collapse">
            <div class="panel-heading">Sidebar22</div>
            <ul class="nav nav-stacked">
                <li class="active"><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>
                <li><a href="#">Link</a></li>              
            </ul>


        </div><!-- /.navbar-collapse -->
    </nav>

</div><!--/end left column-->

<div class="col-md-10">
</div>

Check fiddle out.