diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 08eaad9..d30365b 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -61,7 +61,6 @@ const routes: Routes = [ @NgModule({ imports: [RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules, - scrollPositionRestoration: "top", onSameUrlNavigation: "reload", relativeLinkResolution: 'corrected' })], diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a13660b..c5a00f1 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -15,6 +15,7 @@ import {properties} from "../environments/environment"; import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; import {Option} from "./openaireLibrary/sharedComponents/input/input.component"; import {StakeholderUtils} from "./utils/indicator-utils"; +import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll"; @Component({ @@ -61,6 +62,7 @@ export class AppComponent implements OnInit, OnDestroy { private router: Router, private userManagementService: UserManagementService, private layoutService: LayoutService, + private smoothScroll: SmoothScroll, private stakeholderService: StakeholderService, private cdr: ChangeDetectorRef, private configurationService: ConfigurationService) { this.subscriptions.push(this.router.events.subscribe(event => { @@ -208,6 +210,7 @@ export class AppComponent implements OnInit, OnDestroy { this.layoutService.clearSubscriptions(); this.stakeholderService.clearSubscriptions(); this.configurationService.clearSubscriptions(); + this.smoothScroll.clearSubscriptions(); } private navigateToError() { diff --git a/src/app/methodology/methodology.component.ts b/src/app/methodology/methodology.component.ts index c695a4d..b592848 100644 --- a/src/app/methodology/methodology.component.ts +++ b/src/app/methodology/methodology.component.ts @@ -222,24 +222,10 @@ export class MethodologyComponent implements OnInit, OnDestroy { this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: title}, "property='og:title'"); this._title.setTitle(title); - this.subscriptions.push(this.route.fragment.subscribe(fragment => { - setTimeout(() => { - this.goTo(fragment); - }, 100); - })); } })); } - goTo(id: string) { - const yOffset = -100; - const element = document.getElementById(id); - if (element) { - const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset; - window.scrollTo({top: y, behavior: 'smooth'}); - } - } - ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscription) { diff --git a/src/index.html b/src/index.html index ad8b496..80f6cdc 100644 --- a/src/index.html +++ b/src/index.html @@ -32,6 +32,7 @@ + +