Adjust scroll activation threshold and reset inverseYPos.
Increased the scroll threshold for activating the header to 5 for better usability. Added a reset for `inverseYPos` to 0 when the scroll position is at the top, ensuring consistent behavior.
This commit is contained in:
parent
a1b42060b0
commit
1264003a44
|
|
@ -27,10 +27,11 @@ export class HeaderComponent {
|
||||||
@HostListener('window:scroll', [])
|
@HostListener('window:scroll', [])
|
||||||
onWindowScroll(): void {
|
onWindowScroll(): void {
|
||||||
const scrollPosition = window.scrollY;
|
const scrollPosition = window.scrollY;
|
||||||
if (scrollPosition > 0) {
|
if (scrollPosition > 5) {
|
||||||
this.active = 'active';
|
this.active = 'active';
|
||||||
this.inverseYPos = scrollPosition - (scrollPosition * 0.2);
|
this.inverseYPos = scrollPosition - (scrollPosition * 0.2);
|
||||||
} else {
|
} else {
|
||||||
|
this.inverseYPos = 0;
|
||||||
this.active = '';
|
this.active = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user