Skip to content

Latest commit

 

History

History
104 lines (64 loc) · 2.08 KB

readme.md

File metadata and controls

104 lines (64 loc) · 2.08 KB

After the page is loaded it is possible to access the Breakdance Menu's instance on its HTMLElement:

Examples

const menu = document.querySelector('.breakdance-menu').bdMenu;
const dropdown = document.querySelector('.bde-menu-dropdown-72-105 .breakdance-dropdown');

menu.openDropdown(dropdown);

menu.closeDropdown(dropdown);

menu.closeAll();

menu.toggleMobileMenu();

API

openDropdown(...)

openDropdown(node: HTMLElement)

Open a dropdown menu. It takes in an HTMLElement and then closes all other dropdowns except for the selected one. Works on mobile too.

Param Type
node HTMLElement

closeDropdown(...)

closeDropdown(node: HTMLElement)

Close a dropdown menu. It takes in an HTMLElement. Works on mobile too.

Param Type
node HTMLElement

closeAll()

closeAll()

Close all dropdown menus.

getOpenDropdown()

getOpenDropdown() => DropdownElement | null

Return the currently open dropdown element or null if none is open.

refreshDropdowns()

refreshDropdowns()

Refresh all dropdown menus. It recalculates the open dropdown width and aligns each dropdown element with the menu's container.

toggleMobileMenu()

toggleMobileMenu() => Promise<void>

Open or close the mobile menu. Returns as promise that is resolved once the animation has ended.

isDesktop()

isDesktop() => boolean

Determine whether the menu is showing the desktop version.

isMobile()

isMobile() => boolean

Determine whether the menu is showing the mobile version.

isVertical()

isVertical() => boolean

Determine whether the menu is set to be displayed vertically.