|
|
|
@ -54,14 +54,13 @@ export class HeaderComponent {
|
|
|
|
|
|
|
|
|
|
openCloseMenu() {
|
|
|
|
|
this.isMenuOpen = !this.isMenuOpen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@HostListener('document:click', ['$event'])
|
|
|
|
|
clickout(event: MouseEvent) {
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
// If the menu is open and click is outside the menu, we close it
|
|
|
|
|
if (this.isMenuOpen && !this.menuRef.nativeElement.contains(event.target)) {
|
|
|
|
|
this.isMenuOpen = false;
|
|
|
|
|
if(this.isMenuOpen) {
|
|
|
|
|
// Add an overflow to the body
|
|
|
|
|
document.body.classList.add('no-scroll')
|
|
|
|
|
} else {
|
|
|
|
|
// Remove the overflow of the body
|
|
|
|
|
document.body.classList.remove('no-scroll')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|