Methods
const menu = new LayerMenu('.menu', options);
menu.open('#submenu-id'); // open a submenu and every level above it
menu.open(liOrLinkElement); // also accepts the <li>, its trigger link or the <ul>
menu.open(target, { animate: false });
menu.back(); // one level up
menu.reset(); // back to the root
menu.update({ animation: 'flip', backText: '← {parent}' });
menu.destroy(); // restore the original markup
menu.level; // 0 = root
menu.path; // ['Shop', 'Women']
menu.panel; // the visible <ul>
menu.isAnimating;
LayerMenu.init(selector?, options?); // → instances[]
LayerMenu.get(elementOrSelector); // → instance | null
LayerMenu.animations; // presets, extendable
Clicking quickly never breaks the menu: a new step finishes the running transition first. Creating a second instance on the same element destroys the first one.
Was this article helpful?
Thanks for your feedback!