| | |
| | | constructor() { |
| | | this.counter = 0; |
| | | this.initElements(); |
| | | if (this.navs.length === 0) { |
| | | if (this.navs.size === 0) { |
| | | return; |
| | | } |
| | | |
| | |
| | | document.addEventListener('click', this.clickListener); |
| | | } |
| | | handleClick(e) { |
| | | if (this.navs.size === 0) { |
| | | return; |
| | | } |
| | | if (this.openNav && !e.target.closest(this.openNav)) { |
| | | this.toggleNav(false); |
| | | } |
| | |
| | | let nav = toggle.closest('nav'); |
| | | this.toggleNav(!nav.classList.contains('open'), nav.id); |
| | | } |
| | | |
| | | let submenuToggle = e.target.closest('[data-action="toggle-submenu"]') |
| | | if (submenuToggle) { |
| | | let li = submenuToggle.closest('li'); |
| | | this.toggleSubmenu(!li.classList.contains('open'), li); |
| | | } |
| | | |
| | | } |
| | | |
| | | handleHoverOn(e) { |