diff --git a/docusaurus.config.js b/docusaurus.config.js index 69faacd..1c9b7a7 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -102,4 +102,10 @@ module.exports = { }, ], ], + scripts: [ + { + src: + '/scripts/handleScrollRestoration.js', + }, + ] }; diff --git a/static/scripts/handleScrollRestoration.js b/static/scripts/handleScrollRestoration.js new file mode 100644 index 0000000..bd93e7c --- /dev/null +++ b/static/scripts/handleScrollRestoration.js @@ -0,0 +1,8 @@ +var hash = window.location.hash; +var hashName = hash.substring(1, hash.length); + +if (hashName.startsWith("link-")) { + if ("scrollRestoration" in history) { + history.scrollRestoration = "manual"; + } +}