stylescape
Version:
Stylescape is a visual identity framework developed by Scape Agency.
28 lines (22 loc) • 920 B
text/typescript
// Controls the behavior of dropdown menus, handling show and hide actions.
// export default class DropdownManager {
// private dropdowns: NodeListOf<HTMLElement>
// constructor() {
// this.dropdowns = document.querySelectorAll('.dropdown')
// document.addEventListener('click', this.handleClickOutside.bind(this))
// }
// toggleDropdown(dropdownId: string): void {
// const dropdown = document.getElementById(dropdownId)
// dropdown?.classList.toggle('active')
// }
// private handleClickOutside(event: MouseEvent): void {
// this.dropdowns.forEach((dropdown) => {
// if (!dropdown.contains(event.target as Node)) {
// dropdown.classList.remove('active')
// }
// })
// }
// }
// Usage
// const dropdownManager = new DropdownManager()
// Call dropdownManager.toggleDropdown('dropdownId') to toggle