(mvc/menu) hide empty menu options for second level containers as well

This commit is contained in:
Ad Schellevis 2015-08-28 14:21:23 +02:00
parent ad3472f844
commit 74e3d1f48b

View File

@ -53,9 +53,18 @@
});
// hide empty menu items
$('#mainmenu > div > .collapse').each(function(){
$('#mainmenu > div > .collapse').each(function () {
// cleanup empty second level menu containers
$(this).find("div.collapse").each(function () {
if ($(this).children().length == 0) {
$("#mainmenu").find('[href="#' + $(this).attr('id') + '"]').remove();
$(this).remove();
}
});
// cleanup empty first level menu items
if ($(this).children().length == 0) {
$("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove();
$("#mainmenu").find('[href="#' + $(this).attr('id') + '"]').remove();
}
});