removed url nav anchor

This commit is contained in:
2026-03-18 19:32:59 +01:00
parent 26016f25f0
commit 04d70e3609
+19 -2
View File
@@ -527,7 +527,11 @@ function buildNav() {
// Sidebar link // Sidebar link
const a = document.createElement("a"); const a = document.createElement("a");
a.className = "nav-link"; a.className = "nav-link";
a.href = `#${s.id}`; a.href = "#";
a.onclick = (e) => {
e.preventDefault();
scrollToSection(s.id);
};
a.dataset.target = s.id; a.dataset.target = s.id;
if (s.idx) { if (s.idx) {
const num = document.createElement("span"); const num = document.createElement("span");
@@ -539,7 +543,12 @@ function buildNav() {
// Mobile drawer link // Mobile drawer link
const ma = document.createElement("a"); const ma = document.createElement("a");
ma.href = `#${s.id}`; ma.href = "#";
ma.onclick = (e) => {
e.preventDefault();
scrollToSection(s.id);
closeDrawer();
};
ma.textContent = s.idx ? `${s.idx} – ${s.label}` : s.label; ma.textContent = s.idx ? `${s.idx} – ${s.label}` : s.label;
ma.onclick = closeDrawer; ma.onclick = closeDrawer;
drawerLinks.appendChild(ma); drawerLinks.appendChild(ma);
@@ -569,6 +578,14 @@ setTimeout(() => { buildNav(); setupObserver(); }, 120);
══════════════════════════════════════════════════════ */ ══════════════════════════════════════════════════════ */
function openDrawer() { document.getElementById("drawer").classList.add("open"); } function openDrawer() { document.getElementById("drawer").classList.add("open"); }
function closeDrawer() { document.getElementById("drawer").classList.remove("open"); } function closeDrawer() { document.getElementById("drawer").classList.remove("open"); }
function scrollToSection(id) {
document.getElementById(id).scrollIntoView({
behavior: 'smooth'
});
history.replaceState(null, null, ' ');
}
</script> </script>
</body> </body>
</html> </html>