mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-10 14:01:22 -06:00
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.
This commit is contained in:
parent
528141d30c
commit
672c284b6f
@ -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){
|
||||
|
Loading…
x
Reference in New Issue
Block a user