Events API

Knowledgebase Docs » UberMenu 3
USEFUL? 15
UberMenu 3

The Events API allows you to trigger your code when menu events occur.


ubermenuopen

Fires when a submenu is activated.

Examples

When menu item 28’s submenu is opened, show an alert

jQuery( '#menu-item-28' ).on( 'ubermenuopen', function(){
  //Your code here
  alert( 'Menu Opened' );
});

ubermenuclose

Fires when a submenu is hidden.

Examples

When menu item 28’s submenu is closed, show an alert

jQuery( '#menu-item-28' ).on( 'ubermenuclose', function(){
  //Your code here
  alert( 'Menu Closed' );
});

ubermenutoggledopen

Since UberMenu v3.2.1

Fires on the responsive toggle button when toggled open

Example

When the menu is toggled open, show an alert

jQuery( '.ubermenu-responsive-toggle' ).on( 'ubermenutoggledopen' , function(e){
  //Your code here
  alert( 'Menu Toggled Open' );
});

ubermenutoggledclose

Since UberMenu v3.2.1

Fires on the responsive toggle button when toggled closed

Example

When the menu is toggled closed, show an alert

jQuery( '.ubermenu-responsive-toggle' ).on( 'ubermenutoggledclose' , function(e){
  //Your code here
  alert( 'Menu Toggled Closed' );
});

ubermenuscrollto_complete

Since UberMenu v3.2.1

Fires on the anchor after a Scroll To animation has been completed.

Example

When a ScrollTo link is clicked, display an alert after the scroll completes

jQuery( '.ubermenu-target' ).on( 'ubermenuscrollto_complete' , function(){ 
  alert( 'scrollto complete' ); 
});