Merge pull request #1870 from hunicus/fix-anchors-chrome

Fix anchor link scrolling on load (chrome)
This commit is contained in:
wiz 2022-06-12 03:34:11 +09:00 committed by GitHub
commit 99fcca3cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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