From 672c284b6f66b544878cc7a1a8d3711b6a68e7cf Mon Sep 17 00:00:00 2001 From: Peter Mosses <18308236+pdmosses@users.noreply.github.com> Date: Wed, 3 Aug 2022 07:31:17 +0200 Subject: [PATCH] Fix nav scroll feature (#898) The nav scroll feature had stopped working (altogether), due to the change from absolute to relative urls. This update uses the document location pathname as the `href`. It appears to work locally. --- assets/js/just-the-docs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js index dbc4f65d..f3bd813a 100644 --- a/assets/js/just-the-docs.js +++ b/assets/js/just-the-docs.js @@ -460,7 +460,7 @@ jtd.setTheme = function(theme) { // Scroll site-nav to ensure the link to the current page is visible function scrollNav() { - const href = document.location.href.split('#')[0].replace(/(.+?)\/+$/, "$1"); + const href = document.location.pathname; const siteNav = document.getElementById('site-nav'); const targetLink = siteNav.querySelector('a[href="' + href + '"], a[href="' + href + '/"]'); if(targetLink){ -- GitLab