1window.addEventListener("DOMContentLoaded",function(){ 2 let fixedNavbar = document.querySelector(".navbar.fixed-top") 3 // correct body padding 4 let offsetHeight = fixedNavbar.offsetHeight; 5 let marginTop = offsetHeight - 16; // give more space at the top (ie 1rem) 6 document.body.style.setProperty("padding-top",offsetHeight+"px"); 7 // correct direct navigation via fragment to heading 8 let style = document.createElement("style"); 9 style.classList.add("menubar-fixed-top") 10 style.innerText = `main > h1, main > h2, main > h3, main > h4, main > h5, #dokuwiki__top { 11 padding-top: ${offsetHeight}px; 12 margin-top: -${marginTop}px; 13 z-index: -1; 14}`; 15 document.head.appendChild(style); 16}); 17