Keeps menu open if user is hovering over it
This commit is contained in:
parent
31e1c669b2
commit
ad031dc3f3
|
@ -8,6 +8,8 @@
|
||||||
fxLayoutGap="20px"
|
fxLayoutGap="20px"
|
||||||
fxLayoutAlign="center end"
|
fxLayoutAlign="center end"
|
||||||
[ngClass]="{'scrolling': isScrolling}"
|
[ngClass]="{'scrolling': isScrolling}"
|
||||||
|
(mouseover)="keepMenuOpen()"
|
||||||
|
(mouseout)="isScrolling = false"
|
||||||
>
|
>
|
||||||
<button mat-fab (click)="toggleMenu()" class="toggle-menu" color="primary">
|
<button mat-fab (click)="toggleMenu()" class="toggle-menu" color="primary">
|
||||||
<mat-icon *ngIf="!isScrolling">menu</mat-icon>
|
<mat-icon *ngIf="!isScrolling">menu</mat-icon>
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class AppComponent implements AfterViewInit {
|
||||||
clearTimeout(this.scrollTimer);
|
clearTimeout(this.scrollTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scrollTimer = setTimeout(() => {
|
this.scrollTimer = window.setTimeout(() => {
|
||||||
this.showIndicator = true;
|
this.showIndicator = true;
|
||||||
this.isScrolling = false;
|
this.isScrolling = false;
|
||||||
this.scrollTimer = -1;
|
this.scrollTimer = -1;
|
||||||
|
@ -83,4 +83,9 @@ export class AppComponent implements AfterViewInit {
|
||||||
this.isScrolling = !this.isScrolling;
|
this.isScrolling = !this.isScrolling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keepMenuOpen() {
|
||||||
|
this.isScrolling = true;
|
||||||
|
clearTimeout(this.scrollTimer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue