diff --git a/assets/js/header.js b/assets/js/header.js new file mode 100644 index 0000000..9889c05 --- /dev/null +++ b/assets/js/header.js @@ -0,0 +1,20 @@ + + document.querySelectorAll('.nav-link').forEach(function(link) { + link.addEventListener('click', function(e) { + + const navbarCollapse = document.getElementById('navbarSupportedContent'); + const bsCollapse = new bootstrap.Collapse(navbarCollapse, { + toggle: false + }); + bsCollapse.hide(); + + const targetId = this.getAttribute('href').split('#')[1]; + const targetElement = document.getElementById(targetId); + + if (targetElement) { + targetElement.scrollIntoView({ + behavior: 'smooth' + }); + } + }); + }); \ No newline at end of file diff --git a/includes/header.php b/includes/header.php index 28e2a4b..abb6c29 100644 --- a/includes/header.php +++ b/includes/header.php @@ -8,7 +8,7 @@
@@ -40,7 +40,7 @@ - + +