new Menu(element, options)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element | HTMLElement | DOM element for component instantiation and scope | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options | Object | Properties
|
Classes
Members
(static) supportedEvents :Array.<string>
An array of supported events for this component.
Type:
- Array.<string>
Methods
checkMegaMenu(menuItem)
Parameters:
Name | Type | Description |
---|---|---|
menuItem | Node |
checkMenuItem(menuItem)
- Description:
Check for a specific menu item how to display it:
- number of lines
- mega menu position
- Source:
Parameters:
Name | Type | Description |
---|---|---|
menuItem | Node |
checkMenuOverflow()
closeOpenDropdown()
destroy()
disableScroll()
enableScroll()
handleClickGlobal(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleClickOnBack()
handleClickOnCaret(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleClickOnClose(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
Fires:
handleClickOnNextItems()
handleClickOnOpen(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
Fires:
handleClickOnPreviousItems()
handleClickOnToggle(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleFocusIn(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleFocusOut(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleHoverOffItem(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleHoverOnItem(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleKeyboard(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleKeyboardGlobal(e)
Parameters:
Name | Type | Description |
---|---|---|
e | Event |
handleResize()
init()
on(eventName, callback) → {void}
Example
// Registering a callback for the 'onOpen' event
menu.on('onOpen', (event) => {
console.log('Open event occurred!', event);
});
Parameters:
Name | Type | Description |
---|---|---|
eventName | string | The name of the event to listen for. |
callback | function | The callback function to be invoked when the event occurs. |
Returns:
- Type
- void
positionMenuOverlay()
trigger(eventName, eventData)
Parameters:
Name | Type | Description |
---|---|---|
eventName | string | The name of the event to trigger. |
eventData | any | Data associated with the event. |
useDesktopDisplay()
- Description:
Check if desktop display has to be used
- not using a phone or tablet (whatever the screen size is)
- not having hamburger menu on screen
- Source:
(static) autoInit(root) → {Menu}
Parameters:
Name | Type | Description |
---|---|---|
root | HTMLElement | DOM element for component instantiation and scope |
Returns:
An instance of Menu.
- Type
- Menu