Fixed scroll to top
All checks were successful
Build Website / Build NPM Project (push) Successful in 1m44s
Build Website / Tag Version (push) Successful in 12s
Build Website / Build & Push Dockerfile (push) Successful in 2m51s

This commit is contained in:
Zakary Timson 2024-01-11 14:51:59 -05:00
parent 57c6480877
commit 17ab9b874d

View File

@ -25,6 +25,7 @@ export class NavbarComponent implements AfterViewInit, OnDestroy {
ngAfterViewInit() { ngAfterViewInit() {
this.sub = combineLatest([this.router.events.pipe(filter(e => e instanceof NavigationEnd)), this.route.fragment]).subscribe(([url, frag]) => { this.sub = combineLatest([this.router.events.pipe(filter(e => e instanceof NavigationEnd)), this.route.fragment]).subscribe(([url, frag]) => {
console.log('fire');
if(frag) this.scroll(frag); if(frag) this.scroll(frag);
else this.scrollTop(); else this.scrollTop();
}); });
@ -41,7 +42,6 @@ export class NavbarComponent implements AfterViewInit, OnDestroy {
} }
scrollTop() { scrollTop() {
const container = document.getElementsByClassName('app-container')[0]; window.scrollTo(0, 0);
container.scrollTo(0, 0);
} }
} }