Last active
July 16, 2019 15:14
-
-
Save jerinisready/504c656927a075895575bf3cb2a2657e to your computer and use it in GitHub Desktop.
This is how we made a nested menu within default mdb jquery admin template. available over : https://mdbootstrap.com/snippets/jquery/jerin_john_kachirackal/936124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready((e) => { | |
/* This is the Only Manidatory Script Fot Nested Style Sheet in MDB Dashboard. */ | |
$(".nav-item.has-submenu") | |
.find("a[href='#']") | |
.bind("click", function (e) {e.preventDefault(); | |
let isExpanded = $(this).attr("aria-expanded") == "true"; | |
let submenu = $(this).parent("li").find(".nav-item-submenu").eq(0); | |
$(".nav-item-submenu").slideUp(); | |
$(".nav-item-submenu").parent().find('a').attr("aria-expanded", false); | |
if (!isExpanded) {submenu.slideDown();$(this).attr("aria-expanded", "true") | |
} else {submenu.slideUp();$(this).attr("aria-expanded", "false")} | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is the Only Manidatory Style other than MDB Dashboard. */ | |
ul li.nav-item:not(.active) > a.nav-link:hover, .nav-item.has-submenu> a[aria-expanded="true"]{box-shadow: 2px 2px 5px #c0c0c0; background-color: white} | |
.nav-item.has-submenu {} | |
.nav-item.has-submenu>a {position: relative;} | |
.nav-item.has-submenu>a span {position: absolute;right: 8px;top: 0;bottom: 0;width: 10px;height: 10px;text-align: center;line-height: 15px;margin: auto 0;font-size: 14px;} | |
.nav-item.has-submenu>a[aria-expanded="true"] span{-webkit-transform: rotate(180deg);-moz-transform: rotate(180deg);-ms-transform: rotate(180deg);-o-transform: rotate(180deg);transform: rotate(180deg);right: 3px;top: 5px;} | |
.nav-item-submenu {padding: 0;display: none;margin: 0 16px;list-style: none;list-style-type: none;border-left:2px solid #F44336} | |
.nav-item.has-submenu>a[aria-expanded="true"]{box-shadow: 2px 2px 5px #c0c0c0} | |
.nav-item.has-submenu>a[aria-expanded="true"]+.nav-item-submenu {} | |
.nav-item-submenu li {padding: 1px 8px;} | |
.nav-item-submenu li a {display: block;} | |
.nav-item-submenu li:first-child{padding-top: 10px} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment