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:
@@ -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 = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user