Javascript API

SlickMenu.toggle

Toggle a menu

Usage

SlickMenu.toggle(menu_id, callback)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

callback function()

On complete callback function

SlickMenu.open

Open a menu

Usage

SlickMenu.open(menu_id, callback)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

callback function()

On complete callback function

SlickMenu.openSubLevel

Open a menu sub level

Usage

SlickMenu.openSubLevel(menu_id, menu_item_id, callback)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu_item_id integer

WordPress Slick Menu Item ID

callback function()

On complete callback function

SlickMenu.close

Close a menu

Usage

SlickMenu.close(menu_id, callback)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

callback function()

On complete callback function

SlickMenu.isOpen

Check if a menu is already open

Usage

SlickMenu.isOpen(menu_id)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

Returns

boolean

Returns true if the menu is open or false if it is closed

SlickMenu.get

Get menu DOM element

Usage

SlickMenu.get(menu_id)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

Returns

object

Returns Menu DOM Element or NULL if menu not found

SlickMenu.getOpen

Get currently opened menu ID

Usage

SlickMenu.getOpen()

Arguments

Param Type Details
No Arguments

Returns

integer

Returns WordPress Slick Menu ID or NULL if no menu is currently open

SlickMenu.getCurrentLevel

Get menu active level if the menu is open

Usage

SlickMenu.getCurrentLevel(menu_id)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

Returns

object

Return menu level DOM Element

SlickMenu.getCurrentLevelDepth

Get menu active level depth if the menu is open

Usage

SlickMenu.getCurrentLevelDepth(menu_id)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

Returns

integer

Return menu level depth

SlickMenu.isCreated

If the menu is set to be loaded on demand via AJAX, this will check if the menu has already been created

Usage

SlickMenu.isCreated(menu_id)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

Returns

boolean

Returns true if the menu has been created or false if not

SlickMenu.reload

Reload a menu via ajax

Usage

SlickMenu.reload(menu_id, callback)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

callback function()

On complete callback function

SlickMenu.getAlwaysVisible

Get always visible menu ID

Usage

SlickMenu.getAlwaysVisible()

Arguments

Param Type Details
No Arguments

Returns

integer

Returns WordPress Slick Menu ID or NULL if no menu is set to be always visible

SlickMenu.alwaysVisibleEnabled

Check if one of the menus is set to be always visible

Usage

SlickMenu.alwaysVisibleEnabled()

Arguments

Param Type Details
No Arguments

Returns

boolean

Returns true if one of the menus is set to be always visible or false if not

SlickMenu.isAlwaysVisible

Check if a menu is already is always visible

Usage

SlickMenu.isAlwaysVisible(menu_id)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

Returns

boolean

Returns true if the menu is set to be always visible or false if not

SlickMenu.getOption

Get menu option value by key

Usage

SlickMenu.getOption(menu_id, key)

Arguments

Param Type Details
menu_id integer

WordPress Slick Menu ID

key string

WordPress Menu Term Meta Key

Returns

mix

Returns menu option value

Back To Top

Javascript Events

sm-loaded

Triggers once a menu is loaded

Usage

$(document.body).on('sm-loaded', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-reloading

Triggers once a menu starts re-loading via ajax

Usage

$(document.body).on('sm-reloading', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-reloaded

Triggers once a menu is re-loaded via ajax

Usage

$(document.body).on('sm-reloaded', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-resize

Triggers on window resize

Usage

$(document.body).on('sm-resize', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-resize-start

Triggers once window resizing starts

Usage

$(document.body).on('sm-resize-start', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-resize-stop

Triggers once window resizing stops

Usage

$(document.body).on('sm-resize-stop', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-opening

Triggers before opening a menu

Usage

$(document.body).on('sm-opening', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-open

Triggers once a menu starts opening

Usage

$(document.body).on('sm-open', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-av-open

Triggers once an "Always Visible" menu opens

Usage

$(document.body).on('sm-av-open', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-open-first

Triggers once a menu starts opening for the first time only

Usage

$(document.body).on('sm-open-first', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-closing

Triggers before closing a menu

Usage

$(document.body).on('sm-closing', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-close

Triggers once a menu closes

Usage

$(document.body).on('sm-close', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-av-close

Triggers once an "Always Visible" menu closes

Usage

$(document.body).on('sm-av-close', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

sm-level-opening

Triggers before opening a menu level

Usage

$(document.body).on('sm-level-opening', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); console.log(evt.detail.level); console.log(evt.detail.levelDepth); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

level dom

Menu Level DOM Element

levelDepth integer

Menu Level Depth

sm-level-open

Triggers once a menu level starts opening

Usage

$(document.body).on('sm-level-open', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); console.log(evt.detail.level); console.log(evt.detail.levelDepth); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

level dom

Menu Level DOM Element

levelDepth integer

Menu Level Depth

sm-level-opened

Triggers once a menu level has opened

Usage

$(document.body).on('sm-level-opened', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); console.log(evt.detail.level); console.log(evt.detail.levelDepth); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

level dom

Menu Level DOM Element

levelDepth integer

Menu Level Depth

sm-level-opened

Triggers once a menu level has opened

Usage

$(document.body).on('sm-level-opened', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); console.log(evt.detail.level); console.log(evt.detail.levelDepth); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

level dom

Menu Level DOM Element

levelDepth integer

Menu Level Depth

sm-level-inactive

Triggers once a menu level becomes inactive. (opened, however appears behind another level)

Usage

$(document.body).on('sm-level-inactive', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); console.log(evt.detail.level); console.log(evt.detail.levelDepth); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

level dom

Menu Level DOM Element

levelDepth integer

Menu Level Depth

sm-level-active

Triggers once a menu level becomes active. (opened, and appears on top off all other levels)

Usage

$(document.body).on('sm-level-active', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); console.log(evt.detail.level); console.log(evt.detail.levelDepth); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

level dom

Menu Level DOM Element

levelDepth integer

Menu Level Depth

sm-level-close

Triggers once a menu level closes

Usage

$(document.body).on('sm-level-close', function(evt) { console.log(evt.detail.menu_id); console.log(evt.detail.menu); console.log(evt.detail.level); console.log(evt.detail.levelDepth); });

Event Data

Param Type Details
menu_id integer

WordPress Slick Menu ID

menu dom

Menu DOM Element

level dom

Menu Level DOM Element

levelDepth integer

Menu Level Depth

Back To Top