JavaScript API

jQuery events are fired each time a flyout or mega menu is open and closed. The events are “open_panel” and “close_panel”. You can also manipulate the menu (open and close sub menus) using JavaScript. It is also possible to directly call the plugin functions to open and close panels.

Examples

Important: Your JavaScript must be output after the maxmegamenu.js file. If you are using wp_enqueue_script, make sure “megamenu” is added as a dependency.

Detect when a sub menu for a specific menu item is opened:

Detect when a sub menu for a specific menu item is closed:
Detect when any sub menu is opened:
Close all open sub menus:
Close a single sub menu:
Open a single sub menu:
Remove focus from inputs when a sub menu is closed:

Related Articles