Fixed anchorpoint and tiny-ing of navbar
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, HostListener, Input} from '@angular/core';
|
||||
import {ALTITUDE_VERSION} from '../constant';
|
||||
|
||||
@Component({
|
||||
@@ -12,6 +12,28 @@ export class HeaderComponent {
|
||||
@Input() sub_title: string = '';
|
||||
@Input() current_page: string = ''
|
||||
|
||||
public active: string = ''
|
||||
|
||||
@HostListener('window:scroll', [])
|
||||
onWindowScroll(): void {
|
||||
const scrollPosition = window.scrollY;
|
||||
if (scrollPosition > 0) {
|
||||
this.active = 'active';
|
||||
} else {
|
||||
this.active = '';
|
||||
}
|
||||
}
|
||||
|
||||
scrollToSection(): void {
|
||||
const element = document.getElementById('scrollingpoint');
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
} else {
|
||||
console.error('Element with id "scrollingpoint" not found.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public getCurrentPageId(options: string[]) {
|
||||
if (options.includes(this.current_page)) {
|
||||
return 'current_page'
|
||||
|
||||
Reference in New Issue
Block a user