diff --git a/frontend/src/app/components/docs/api-docs.component.html b/frontend/src/app/components/docs/api-docs.component.html
index 1b0f2a66b..8358129f5 100644
--- a/frontend/src/app/components/docs/api-docs.component.html
+++ b/frontend/src/app/components/docs/api-docs.component.html
@@ -22,7 +22,7 @@
-
+
diff --git a/frontend/src/app/components/docs/api-docs.component.ts b/frontend/src/app/components/docs/api-docs.component.ts
index c209a2771..bbc8cad76 100644
--- a/frontend/src/app/components/docs/api-docs.component.ts
+++ b/frontend/src/app/components/docs/api-docs.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit, Input } from '@angular/core';
+import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core';
import { Env, StateService } from 'src/app/services/state.service';
import { Observable, merge, of } from 'rxjs';
import { SeoService } from 'src/app/services/seo.service';
@@ -17,6 +17,7 @@ export class ApiDocsComponent implements OnInit {
code: any;
baseNetworkUrl = '';
@Input() restTabActivated: Boolean;
+ @ViewChild( "mobileFixedApiNav", { static: false } ) mobileFixedApiNav: ElementRef;
desktopDocsNavPosition = "relative";
showFloatingDocsNav = false;
mobileMenuOpen = true;
@@ -26,6 +27,16 @@ export class ApiDocsComponent implements OnInit {
private seoService: SeoService,
) { }
+ ngAfterViewInit() {
+ const that = this;
+ setTimeout( () => {
+ window.addEventListener('scroll', function() {
+ that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative";
+ that.showFloatingDocsNav = ( window.pageYOffset > ( that.mobileFixedApiNav.nativeElement.offsetHeight + 188 ) ) ? true : false;
+ });
+ }, 1 );
+ }
+
ngOnInit(): void {
this.env = this.stateService.env;
this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`);
@@ -38,13 +49,6 @@ export class ApiDocsComponent implements OnInit {
})
);
- //to toggle fixed menu for desktop navigation
- const that = this;
- window.addEventListener('scroll', function() {
- that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative";
- that.showFloatingDocsNav = ( window.pageYOffset > 1425 ) ? true : false;
- });
-
if (document.location.port !== '') {
this.hostname = `${this.hostname}:${document.location.port}`;
}