Landing: scroll to tab top when change page inside a tab

This commit is contained in:
argirok 2022-06-16 10:56:09 +03:00
parent 13ae37cb61
commit 9e7a6852cc
1 changed files with 9 additions and 1 deletions

View File

@ -607,6 +607,7 @@ export class ResultLandingComponent {
public updateRelatedPage($event) {
this.relatedPage = $event.value;
this.scrollToTabTop('all_related');
}
public updateSimilarPage($event) {
@ -628,7 +629,14 @@ export class ResultLandingComponent {
public updateOpenCitationsPage($event) {
this.openCitationsPage = $event.value;
}
scrollToTabTop(tabId:string){
setTimeout(() => {
window.scrollTo({
top: document.getElementById(tabId) ? document.getElementById(tabId).offsetTop - 250 : 250,
behavior: 'smooth'
});
}, 200);
}
public accessClass(accessMode: string): string {
if (accessMode.toLowerCase().indexOf('open') !== -1) {
return 'open';