Explorar o código

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

Fix #2345
George Cushen %!s(int64=3) %!d(string=hai) anos
pai
achega
caf535a66d
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      wowchemy/assets/js/wowchemy.js

+ 4 - 4
wowchemy/assets/js/wowchemy.js

@@ -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;
 }
 
 /**