"Multi Level Mega Menu Step by Step"
Bootstrap 4.1.1 Snippet by ugnandish

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main_nav"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="main_nav"> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link" href="#"> Home </a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown"> Mega submenu </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#"> Dropdown item 1 </a></li> <li><a class="dropdown-item" href="#"> Dropdown item 2 </a></li> <li class="has-submenu"> <a class="dropdown-item dropdown-toggle" href="#"> Dropdown item 3 </a> <div class="megasubmenu dropdown-menu"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li class="has-submenu"> <a class="dropdown-item dropdown-toggle" href="#"> Dropdown item 4 </a> <div class="megasubmenu dropdown-menu"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </div> </li> <li><a class="dropdown-item" href="#"> Dropdown item 6 </a></li> </ul> </li> <li class="nav-item"> <a class="nav-link" href="#">Menu item </a> </li> <li class="nav-item"><a class="nav-link" href="#"> About </a></li> </ul> </div> <!-- navbar-collapse.// --> </nav>
.megasubmenu{ padding: 20px; } @media (min-width: 992px){ .dropdown-menu .dropdown-toggle:after{ border-top: .3em solid transparent; border-right: 0; border-bottom: .3em solid transparent; border-left: .3em solid; } .dropdown-menu{ margin:0; } .megasubmenu{ left:100%; top:0; min-height: 100%; min-width:500px; } .dropdown-menu > li:hover .megasubmenu{ display: block; } }
// Prevent closing from click inside dropdown $(document).on('click', '.dropdown-menu', function (e) { e.stopPropagation(); }); // clickable on mobile view if ($(window).width() < 992) { $('.has-submenu a').click(function(e){ e.preventDefault(); $(this).next('.megasubmenu').toggle(); $('.dropdown').on('hide.bs.dropdown', function () { $(this).find('.megasubmenu').hide(); }) }); }

Related: See More


Questions / Comments: