FEATURE Handle self page scrolling
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2025-10-07 17:43:57 +02:00
parent 3418325d03
commit a762d15768
2 changed files with 13 additions and 0 deletions

View File

@ -1,8 +1,10 @@
import menuInit from './header';
import initFooterShapes from './footer';
import handleScrollTop from './utilities/scroll-top';
import handleInsidePageScrolling from './page-scrolling';
window.addEventListener('load', function () {
// menuInit();
initFooterShapes();
handleScrollTop();
handleInsidePageScrolling();
});

View File

@ -0,0 +1,11 @@
export default function HandleInsidePageScrolling() {
const insideLinks = document.querySelectorAll('a[href^="#"]');
insideLinks.forEach((link) => {
link.addEventListener('click', (e) => {
e.preventDefault();
const target = document.querySelector(link.getAttribute('href'));
target?.scrollIntoView({ behavior: 'smooth' });
});
});
}