|
|
|
@ -42,16 +42,17 @@ export class NavMenu extends HTMLElement { |
|
|
|
this.shadowRoot.append(this.pageList) |
|
|
|
this.renderPageList() |
|
|
|
this.shadowRoot.addEventListener('click', e => { |
|
|
|
if (this.handleLinks) { |
|
|
|
e.preventDefault() |
|
|
|
} |
|
|
|
if (e.target.classList.contains('page')) { |
|
|
|
if (this.handleLinks) { |
|
|
|
e.preventDefault() |
|
|
|
} |
|
|
|
this.dispatchEvent(new CustomEvent( |
|
|
|
'close-menu', {bubbles: true} |
|
|
|
)) |
|
|
|
} |
|
|
|
if (this.handleLinks) { |
|
|
|
location.hash = `#${e.target.innerText}` |
|
|
|
if (this.handleLinks) { |
|
|
|
const hash = '#' + e.target.innerText |
|
|
|
location.hash = hash |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|