Skip to content
Snippets Groups Projects
Unverified Commit 672c284b authored by Peter Mosses's avatar Peter Mosses Committed by GitHub
Browse files

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.
parent 528141d3
No related branches found
No related tags found
No related merge requests found
......@@ -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){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment