diff --git a/website/static/main.js b/website/static/main.js index f3e29f6..32b71fb 100644 --- a/website/static/main.js +++ b/website/static/main.js @@ -44,6 +44,17 @@ function initRevealSections() { initRevealSections(); +// Smooth scroll without hash in URL +document.querySelectorAll("[data-scroll-to]").forEach(function (link) { + link.addEventListener("click", function (e) { + var target = document.getElementById(link.dataset.scrollTo); + if (!target) return; + e.preventDefault(); + var motion = window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth"; + target.scrollIntoView({ behavior: motion }); + }); +}); + // Pause hero animations when scrolled out of view (function () { const hero = document.querySelector(".hero"); diff --git a/website/templates/index.html b/website/templates/index.html index 7c1a000..3155874 100644 --- a/website/templates/index.html +++ b/website/templates/index.html @@ -36,7 +36,7 @@