"Sidebar Responsive"
Bootstrap 3.2.0 Snippet by website123

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <nav class="navbar navbar-default" role="navigation"> <div class="container"> <nav class="navbar navbar-default"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <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="#">Brand</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li><a href="#">Separated link</a></li> <li class="divider"></li> <li><a href="#">One more separated link</a></li> </ul> </li> </ul> <form class="navbar-form navbar-left" role="search"> <div class="form-group"> <input type="text" class="form-control" placeholder="Search"> </div> <button type="submit" class="btn btn-default">Submit</button> </form> <ul class="nav navbar-nav navbar-right"> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Dropdown <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> <li><a href="#">Something else here</a></li> <li class="divider"></li> <li><a href="#">Separated link</a></li> </ul> </li> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav> <div id="sidebar-wrapper" class="sidebar-toggle"> <ul class="sidebar-nav"> <li> <a href="#item1">Item 1</a> </li> <li> <a href="#item2">Item 2</a> </li> <li> <a href="#item3">Item 3</a> </li> </ul> </div> </div> </nav>
#sidebar-wrapper { top: 52px; left: -200px; width: 200px; background-color: #5677fc; color: white; position: fixed; height: 100%; z-index: 1; } .sidebar-nav { position: absolute; top: 0; margin: 0; padding: 0; width: 250px; list-style: none; } .sidebar-nav li { text-indent: 20px; line-height: 50px; } .sidebar-nav li a { color: white; display: block; text-decoration: none; } .sidebar-nav li a:hover { background: rgba(255,255,255,0.25); color: white; text-decoration: none; } .sidebar-nav li a:active, .sidebar-nav li a:focus { text-decoration: none; } #sidebar-wrapper.sidebar-toggle { transition: all 0.3s ease-out; margin-left: -200px; } @media (min-width: 768px) { #sidebar-wrapper.sidebar-toggle { transition: 0s; left: 200px; } }
$(window).resize(function() { var path = $(this); var contW = path.width(); if(contW >= 751){ document.getElementsByClassName("sidebar-toggle")[0].style.left="200px"; }else{ document.getElementsByClassName("sidebar-toggle")[0].style.left="-200px"; } }); $(document).ready(function() { $('.dropdown').on('show.bs.dropdown', function(e){ $(this).find('.dropdown-menu').first().stop(true, true).slideDown(300); }); $('.dropdown').on('hide.bs.dropdown', function(e){ $(this).find('.dropdown-menu').first().stop(true, true).slideUp(300); }); $("#menu-toggle").click(function(e) { e.preventDefault(); var elem = document.getElementById("sidebar-wrapper"); left = window.getComputedStyle(elem,null).getPropertyValue("left"); if(left == "200px"){ document.getElementsByClassName("sidebar-toggle")[0].style.left="-200px"; } else if(left == "-200px"){ document.getElementsByClassName("sidebar-toggle")[0].style.left="200px"; } }); });

Related: See More


Questions / Comments: