Functions API

Knowledgebase Docs » UberMenu 3
USEFUL? 14
UberMenu 3

The Functions API provides functions which allow you to perform actions on the menu.

In the examples below .ubermenu will target all UberMenus on the page. If you only have one UberMenu, this is just fine, but if you halve multiple UberMenus you’ll want to use a more specific selector.

Open a submenu

Pass the function the jQuery object of the menu item whose submenu you would like to open. Here we’ve selected it via its ID. Note that this is the LI (menu item) as opposed to the anchor (target). You can use any method to select that LI object, it does not have to be by ID.

jQuery( '.ubermenu' ).ubermenu( 'openSubmenu' , jQuery( '#menu-item-28' ) );

Close a specific submenu

Pass the function the jQuery object of the menu item whose submenu you would like to close. Here we’ve selected it via its ID. Note that this is the LI (menu item) as opposed to the anchor (target). You can use any method to select that LI object, it does not have to be by ID.

jQuery( '.ubermenu' ).ubermenu( 'closeSubmenu' , jQuery( '#menu-item-28' ) );

Close all submenus

Close all open submenus in the menu

jQuery( '.ubermenu' ).ubermenu( 'closeAllSubmenus' );

Recalculate submenu positions the submenus

jQuery( '.ubermenu' ).ubermenu( 'positionSubmenus' );

Toggle the responsive menu

jQuery( '.ubermenu' ).ubermenu( 'toggleMenuCollapse' );