"Navigation Sidebar with Toggle"
Bootstrap 3.0.3 Snippet by animeshmanglik

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div id="wrapper" class="active"> <!-- Sidebar --> <!-- Sidebar --> <div id="sidebar-wrapper"> <ul id="sidebar_menu" class="sidebar-nav"> <li class="sidebar-brand"><a id="menu-toggle" href="#">Menu<span id="main_icon" class="glyphicon glyphicon-align-justify"></span></a></li> </ul> <ul class="sidebar-nav" id="sidebar"> <li><a>Link1<span class="sub_icon glyphicon glyphicon-link"></span></a></li> <li><a>link2<span class="sub_icon glyphicon glyphicon-link"></span></a></li> </ul> </div> <!-- Page content --> <div id="page-content-wrapper"> <!-- Keep all page content within the page-content inset div! --> <div class="page-content inset"> <div class="row"> <div class="col-md-12"> <p class="well lead">An Experiment using the sidebar template from startbootstrap.com which I integrated in my website (<a href="http://animeshmanglik.name">animeshmanglik.name</a>)</p> <p class="well lead">Click on the Menu to Toggle Sidebar . Hope you enjoy it!</p> </div> </div> </div> </div> </div>
.row{ margin-left:0px; margin-right:0px; } #wrapper { padding-left: 70px; transition: all .4s ease 0s; height: 100% } #sidebar-wrapper { margin-left: -150px; left: 70px; width: 150px; background: #222; position: fixed; height: 100%; z-index: 10000; transition: all .4s ease 0s; } .sidebar-nav { display: block; float: left; width: 150px; list-style: none; margin: 0; padding: 0; } #page-content-wrapper { padding-left: 0; margin-left: 0; width: 100%; height: auto; } #wrapper.active { padding-left: 150px; } #wrapper.active #sidebar-wrapper { left: 150px; } #page-content-wrapper { width: 100%; } #sidebar_menu li a, .sidebar-nav li a { color: #999; display: block; float: left; text-decoration: none; width: 150px; background: #252525; border-top: 1px solid #373737; border-bottom: 1px solid #1A1A1A; -webkit-transition: background .5s; -moz-transition: background .5s; -o-transition: background .5s; -ms-transition: background .5s; transition: background .5s; } .sidebar_name { padding-top: 25px; color: #fff; opacity: .7; } .sidebar-nav li { line-height: 40px; text-indent: 20px; } .sidebar-nav li a { color: #999999; display: block; text-decoration: none; } .sidebar-nav li a:hover { color: #fff; background: rgba(255,255,255,0.2); text-decoration: none; } .sidebar-nav li a:active, .sidebar-nav li a:focus { text-decoration: none; } .sidebar-nav > .sidebar-brand { height: 65px; line-height: 60px; font-size: 18px; } .sidebar-nav > .sidebar-brand a { color: #999999; } .sidebar-nav > .sidebar-brand a:hover { color: #fff; background: none; } #main_icon { float:right; padding-right: 65px; padding-top:20px; } .sub_icon { float:right; padding-right: 65px; padding-top:10px; } .content-header { height: 65px; line-height: 65px; } .content-header h1 { margin: 0; margin-left: 20px; line-height: 65px; display: inline-block; } @media (max-width:767px) { #wrapper { padding-left: 70px; transition: all .4s ease 0s; } #sidebar-wrapper { left: 70px; } #wrapper.active { padding-left: 150px; } #wrapper.active #sidebar-wrapper { left: 150px; width: 150px; transition: all .4s ease 0s; } }
$("#menu-toggle").click(function(e) { e.preventDefault(); $("#wrapper").toggleClass("active"); });

Related: See More


Questions / Comments:

Awesome dear thanks

usmanawan83 (-1) - 4 years ago - Reply 0


Awesome it's simple and functional, thanks for sharing
Browse web site
https://mwebtasarim.com/

Ömer ÖZER () - 6 years ago - Reply 0


hi there i like to understand how page expand and stretch while make menu toggle.

pralad () - 7 years ago - Reply 0


Didn't work for me :(

Jv () - 7 years ago - Reply 0


Can someone share a download link for this?

Jv () - 7 years ago - Reply 0


Hi!, It is posibble to add submenus to the Sidebar?

Mayanin Sobrevilla () - 7 years ago - Reply 0


How can you make the side bar scrollable?
i tried adding bottom:0; top:0; but doesn't seem to work.
( i have a top nav bar as well);

brianho () - 8 years ago - Reply 0


define height for the ul element and overflow scroll property

Vicente Orrico Fermán () - 8 years ago - Reply 0


How can i repeat the current state of the sidebar (collapsed or not) to the other page? when i click to a link i want that the sidebar state is the same of the previous page. I have read that i can use jquery cookie, how?

Nicholas () - 9 years ago - Reply 0


There are two ways for me....use ajax to refresh the content without change the page so..the sidebar will retain the state...or pass a get parameter

through the link ..so the new pages ...will read the get parameters if exist.. someone special that will make the magic

Vicente Orrico Fermán () - 8 years ago - Reply 0


can anyone tell me how to use this sidebar nav ?

Hieu () - 9 years ago - Reply 0


entire sheet becomes dark and when i use the toggle a part of the sheet is seen? what is the reason

shanthi () - 9 years ago - Reply 0


very interesting, cant wait to try it out

Ergys Ura () - 9 years ago - Reply 0


Awesome it's simple and functional, thanks for sharing

Cesar () - 9 years ago - Reply 0


Question.. where do the 'page-content' and 'inset' styles come from? They're not in the provided css. Thanks.

Chris () - 9 years ago - Reply 0


Nevermind. It wasn't working for me and I thought those classes were responsible. But I found the real problem.

Chris () - 9 years ago - Reply 0


Why does the side bar not work correctly in IE for me, but if I use this bootsnipp site, or your website it does work? I know I'm missing something, but I'm scratching my head...

david () - 9 years ago - Reply 0


Oo I see what I did, sorry for the quick post: I had changed the class from active, to inactive - to test starting the menu out hidden on the page load. It actually worked for Chrome, but when I loaded in IE, it was broken.

david () - 9 years ago - Reply 0


Doesn't work in other theme, how I fix?

Faber Vergara () - 9 years ago - Reply 0


In which theme?

maxsurguy () - 9 years ago - Reply 0


Lumen

Faber Vergara () - 9 years ago - Reply 0


I still see it working but alignment of the icons is not the best. Is that what you see as well?

maxsurguy () - 9 years ago - Reply 0


Amazing and beautiful
i have just one question...i had been playing around whit it, but i still dont know how to make it hide all automatically when is less than 767px... if someone knows, them please some help!!!:. thanks a lot..

gab () - 9 years ago - Reply 0


ok..just done!!:.. i just remove the active class from the sidebar-wrapper div... ¬¬ it was simple... but sometimes take a lot of time to find the simplicity XD..thanks any way!!! great sidebar menu

gab () - 9 years ago - Reply 0


dude, i just jumped into our CV web-site and i like it very much, it's simple and nice. well done and thx for sharing, now wona to create something like this aswell)))

oleg sapishchuk () - 10 years ago - Reply 0


Nice original one-page site with fixed left menu, thanks for sharing.

Erik () - 10 years ago - Reply 0