Bootstrap Sidebar Menu with Submenu

Bootstrap Sidebar Menu with Submenu
Code Snippet: Bootstrap 4.1.3 sidebar nav
Author: Darryl
Official website: Go to website
Published: 2 weeks ago
Views: 338

Yet another Bootstrap code snippet to create a sidebar menu with submenu. It creates fancy side navigation with colorful hover effects. This navigation comes with an animated hamburger icon that toggles the menu. The menu drawer pushes the main content on open and an overlay covers the contents.

How to Create a Sidebar Menu with Submenu using Bootstrap?

1. In order to create a sidebar menu, load the Bootstrap, Font Awesome, and other necessary CSS files into the head tag of your website.

<link rel='stylesheet' href=''>
<link rel='stylesheet' href=''>
<link rel='stylesheet' href=''>
<link rel='stylesheet' href=''>
<link rel="stylesheet" href="css/style.css">

2. After that, create HTML strcuture for the navigation and main content as follows:

<div id="wrapper">
   <div class="overlay"></div>
        <!-- Sidebar -->
    <nav class="navbar navbar-inverse fixed-top" id="sidebar-wrapper" role="navigation">
     <ul class="nav sidebar-nav">
       <div class="sidebar-header">
       <div class="sidebar-brand">
         <a href="#">Brand</a></div></div>
       <li><a href="#home">Home</a></li>
       <li><a href="#about">About</a></li>
       <li><a href="#events">Events</a></li>
       <li><a href="#team">Team</a></li>
       <li class="dropdown">
       <a href="#works" class="dropdown-toggle"  data-toggle="dropdown">Works <span class="caret"></span></a>
     <ul class="dropdown-menu animated fadeInLeft" role="menu">
      <div class="dropdown-header">Dropdown heading</div>
      <li><a href="#pictures">Pictures</a></li>
      <li><a href="#videos">Videeos</a></li>
      <li><a href="#books">Books</a></li>
      <li><a href="#art">Art</a></li>
      <li><a href="#awards">Awards</a></li>
      <li><a href="#services">Services</a></li>
      <li><a href="#contact">Contact</a></li>
      <li><a href="#followme">Follow me</a></li>
        <!-- /#sidebar-wrapper -->

        <!-- Page Content -->
        <div id="page-content-wrapper">
            <button type="button" class="hamburger animated fadeInLeft is-closed" data-toggle="offcanvas">
                <span class="hamb-top"></span>
    			<span class="hamb-middle"></span>
				<span class="hamb-bottom"></span>
            <div class="container">
                <div class="row">
                    <div class="col-lg-8 col-lg-offset-2"">
                       <p> Your content goes here... </p>

        <!-- /#page-content-wrapper -->


3. Now, load the jQuery, Bootstrap and other JavaScript files into your HTML document.

<script src=''></script>
<script src=''></script>
<script src=''></script>
<script src=''></script>

4. Finally, initialize the sidebar navigation menu in jQuery document ready function.

$(document).ready(function () {
  var trigger = $('.hamburger'),
      overlay = $('.overlay'),
     isClosed = false; () {

    function hamburger_cross() {

      if (isClosed == true) {          
        isClosed = false;
      } else {  ;
        isClosed = true;
  $('[data-toggle="offcanvas"]').click(function () {

That’s all! Hopefully, you have successfully implemented this Bootstrap sidebar menu. If you need any further help, let me know by comment below.

Be the first to comment

Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.