From 64d67e510e7b96b1f1d1b79241ed90d3b2f0a402 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Sun, 15 May 2022 15:02:31 -0400 Subject: [PATCH] json: Make URL #fragment jump to the right spot after loading (#233) --- src/resources/js/json-docs.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/resources/js/json-docs.js b/src/resources/js/json-docs.js index 2967be1..c0f6d09 100644 --- a/src/resources/js/json-docs.js +++ b/src/resources/js/json-docs.js @@ -22,6 +22,12 @@ $.get("/api/docs/config"+configPath, function(json) { $(''+pathComponents[i]+'').appendTo($bc); } + // re-trigger the URL fragment if any, to scroll to the archor + var fragment = window.location.hash; + if (fragment) { + window.location.hash = ''; + window.location.hash = fragment; + } }); }); @@ -43,4 +49,4 @@ function setPageTitle() { document.title = titlePrefix + " - " + document.title; } } -} \ No newline at end of file +}