Home › Forums › Design › Add Submenu items – dropdown › Reply To: Add Submenu items – dropdown
November 8, 2015 at 2:01 pm
#234704
Chris Coyier
Keymaster
Looks like the list item that has the submenu has a class menu-item-has-children
so you could write like…
.menu-item-has-children .sub-menu {
/* hide this by default somehow maybe like this: */
height: 0;
overflow: hidden;
}
Then you’ll have to write some JavaScript to deal with opening it, something like…
$(".menu-item-has-children").on("click", function() {
$(this).toggleClass("open-sub-menu");
});
in which this CSS would do the opening
.menu-item-has-children.open-sub-menu .sub-menu {
height: auto;
}
There is lots more fancy things you could do, but that’ll get you started.