onClick (object)

A map of options for when a link in the menu is clicked.

Possible values: an object, true or false.


Code example:

$("#my-menu").mmenu({
   onClick   : {
      close             : true,
      setSelected       : true,
      setLocationHref   : null,
      delayLocationHref : true,
      blockUI           : null,
      callback          : null
   }
});

Note that most boolean-options in the onClick object can also be a function that returns a boolean. Inside this function this refers to the clicked link.


onClick.close (boolean/function)

Whether or not the menu should close after clicking a link inside it.

Default value: true.

onClick.setSelected (boolean/function)

Whether or not the clicked link should be visibly "selected".

Default value: true.

onClick.setLocationHref (boolean/function)

Whether or not the window.location.href should be set to the href of the clicked link.

Default value: false if the href is equal to or starts with a hash (#), true otherwise.

onClick.delayLocationHref (boolean/function)

Whether or not to delay setting the window.location.href until after the menu has closed.

Default value: true.

onClick.blockUI (boolean/function)

Whether or not to block the user interface while loading the new page.

Default value: false if the href is equal to or starts with a hash (#), true otherwise.

onClick.callback (function)

A function to call after the menu has closed. Inside this function, this refers to the clicked link.

Default value: null.