After the page is loaded it is possible to access the Breakdance Menu's instance on its HTMLElement:
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();
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(node: HTMLElement)
Close a dropdown menu. It takes in an HTMLElement. Works on mobile too.
Param | Type |
---|---|
node |
HTMLElement |
closeAll()
Close all dropdown menus.
getOpenDropdown() => DropdownElement | null
Return the currently open dropdown element or null if none is open.
refreshDropdowns()
Refresh all dropdown menus. It recalculates the open dropdown width and aligns each dropdown element with the menu's container.
toggleMobileMenu() => Promise<void>
Open or close the mobile menu. Returns as promise that is resolved once the animation has ended.
isDesktop() => boolean
Determine whether the menu is showing the desktop version.
isMobile() => boolean
Determine whether the menu is showing the mobile version.
isVertical() => boolean
Determine whether the menu is set to be displayed vertically.