diff --git a/index.html b/index.html index e00d106..d5cbf09 100644 --- a/index.html +++ b/index.html @@ -143,13 +143,13 @@
Software Engineer
My skills My portfolio { + button.addEventListener('click', function(e) { + console.log('clicked'); + e.preventDefault(); // Prevent the default anchor behavior + const targetId = e.currentTarget.getAttribute("href"); + const targetElement = document.querySelector(targetId); + const navbarHeight = document.querySelector('nav').offsetHeight; // Replace 'nav' with your navbar selector + + // Smooth scroll to the section, adjusted for the navbar height + window.scrollTo({ + top: targetElement.offsetTop - navbarHeight, + behavior: 'smooth' + }); + }); +}); \ No newline at end of file