open menu with name

This commit is contained in:
zombieFox 2021-08-28 00:28:54 +01:00
parent 264316ebea
commit cdab348a87
2 changed files with 13 additions and 2 deletions

View File

@ -35,12 +35,18 @@ menu.element = {
frame: null
};
menu.open = () => {
menu.open = (name) => {
menu.element.frame = new MenuFrame({
navData: menu.navData
});
if (name) {
menu.element.frame.menuNav.state.toggle(name);
};
menu.element.frame.open();
};

View File

@ -34,7 +34,7 @@ export const MenuNav = function({
item.active = false;
if (item.name === name) {
if (item.name === name || item.name.toLowerCase() === name) {
item.active = true;
};
@ -67,11 +67,13 @@ export const MenuNav = function({
};
this.update = () => {
navData.forEach((item, i) => {
if (this.state.current[this.makeId(item.name)]) {
this.element.item[i].menuNavItem.classList.add('active');
this.element.item[i].topLevel.classList.add('active');
if (item.sub) {
@ -85,7 +87,9 @@ export const MenuNav = function({
};
} else {
this.element.item[i].menuNavItem.classList.remove('active');
this.element.item[i].topLevel.classList.remove('active');
if (item.sub) {
@ -101,6 +105,7 @@ export const MenuNav = function({
};
});
};
this.nav = () => {