1
|
import {AfterViewChecked, Component, OnInit} from '@angular/core';
|
2
|
import {faqs} from './faqs';
|
3
|
import {ActivatedRoute} from '@angular/router';
|
4
|
import {Title} from '@angular/platform-browser';
|
5
|
|
6
|
@Component({
|
7
|
selector: 'about',
|
8
|
templateUrl: 'about.component.html',
|
9
|
styleUrls: ['about.component.css'],
|
10
|
})
|
11
|
export class AboutComponent implements OnInit {
|
12
|
faqs: any[] = faqs;
|
13
|
|
14
|
constructor(private title: Title,
|
15
|
private route: ActivatedRoute) {
|
16
|
}
|
17
|
|
18
|
ngOnInit() {
|
19
|
this.title.setTitle('OpenAIRE - UsageCounts | About');
|
20
|
this.route.fragment.subscribe(fragment => {
|
21
|
setTimeout(() => {
|
22
|
this.goTo(fragment);
|
23
|
}, 100);
|
24
|
});
|
25
|
}
|
26
|
|
27
|
goTo(id: string) {
|
28
|
const yOffset = -100;
|
29
|
const element = document.getElementById(id);
|
30
|
if(element) {
|
31
|
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
32
|
window.scrollTo({top: y, behavior: 'smooth'});
|
33
|
}
|
34
|
}
|
35
|
}
|