I'm currently working on adding a sidebar to my Twitter Bootstrap 3 project. The goal is to have a fixed positioned nav nav-pills nav-stacked
show up on the left side of the page when a button is clicked. I've set its z-index
to 1000 so it appears above all other content.
For a live example, check out this Fiddle: http://jsfiddle.net/mavent/8YtDS/14/
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header"> <a class="navbar-brand navbar-left" href="/" title="">
MyBrand
</a>
</div>
</nav>
<div class="col-md-3" id="mysidebar" style="top: 0;bottom:0; left: 10px;
position: fixed; height: 100%; background-color: #faff18;
opacity: 0.9; overflow: hidden; z-index:1000; margin: 0; padding: 0; display:none;">
<div style="position: relative; top: 60px; background-color: #7d1c80; opacity: 0.9;">
<ul class="nav nav-pills nav-stacked">
<li><a href="">Do something</a>
</li>
<li><a href="">Do something</a>
</li>
<li><a href="">Do something</a>
</li>
<li><a href="">Do something</a>
</li>
<li><a href="">Do something</a>
</li>
<li><a href="">Do something</a>
</li>
<li><a href="">Do something</a>
</li>
<li><a href="">Do something</a>
</li>
</ul>
</div>
</div>
<div class="row" style="background-color: #aaa;">
<div class="col-md-offset-3">
<button> </button>
<button id="mybutton" type="button" class="btn btn-info">Click me to toggle</button>
</div>
</div>
However, I want the sidebar to push the page to the right when it appears. A similar effect can be seen on this website where clicking the top left button triggers the behavior: