var enable_debug = true; var UI = { smoothScrollToNamedAnchors: function() { $('a[href^="#"]').each(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const target = document.querySelector(this.getAttribute('href')); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); }); }, enablePageTransitions: function() { $(document.body).append(``); document.addEventListener('click', e => { const link = e.target.closest('a[href]'); if (!link) return; e.preventDefault(); document.startViewTransition(() => { window.location.href = link.href; }); }); }, init: function() { //UI.enablePageTransitions(); UI.smoothScrollToNamedAnchors(); document.body.classList.add('loaded'); }, } $.ready(UI.init);