Fix anchor link scrolling on load (chrome)

This commit is contained in:
hunicus 2022-06-11 12:17:34 -04:00
parent 6bbea198e5
commit abaaef2285
No known key found for this signature in database
GPG key ID: 24837C51B6D81FD9

View file

@ -35,6 +35,7 @@ export class ApiDocsComponent implements OnInit {
setTimeout( () => { setTimeout( () => {
if( this.route.snapshot.fragment ) { if( this.route.snapshot.fragment ) {
this.openEndpointContainer( this.route.snapshot.fragment ); this.openEndpointContainer( this.route.snapshot.fragment );
document.getElementById( this.route.snapshot.fragment ).scrollIntoView();
} }
window.addEventListener('scroll', function() { window.addEventListener('scroll', function() {
that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative"; that.desktopDocsNavPosition = ( window.pageYOffset > 182 ) ? "fixed" : "relative";