From 9e7a6852ccc3ba94706c82389476c19a758de86e Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 16 Jun 2022 10:56:09 +0300 Subject: [PATCH] Landing: scroll to tab top when change page inside a tab --- landingPages/result/resultLanding.component.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index b8db5e3e..d9b2c4ac 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -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';