fix: anchor linking (e.g. ToC) does not work when navbar is disabled

Fix #2345
This commit is contained in:
George Cushen committed 2021-06-19 22:05:49 +01:00
1 parent cc42eb4135
commit caf535a66d
1 file changed
+4 -4
+4 -4
View File
@@ -23,10 +23,10 @@ console.debug(`Environment: ${hugoEnvironment}`);
// Dynamically get responsive navigation bar height for offsetting Scrollspy.
function getNavBarHeight() {
let $navbar = $('#navbar-main');
let navbar_offset = $navbar.outerHeight();
console.debug('Navbar height: ' + navbar_offset);
return navbar_offset;
let navbar = document.getElementById('navbar-main');
let navbarHeight = (navbar) ? navbar.outerHeight() : 0;
console.debug('Navbar height: ' + navbarHeight);
return navbarHeight;
}
/**