From e22a2beaa6800aff6e1df2b1dd8e9a4f428f35b7 Mon Sep 17 00:00:00 2001 From: Aashish_Nepal Date: Wed, 11 Dec 2024 16:39:59 +0545 Subject: [PATCH] Updated --- assets/js/header.js | 20 ++++++++++++++++++++ includes/header.php | 7 ++++--- templates/services.php | 4 ---- 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 assets/js/header.js 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 @@ - + + diff --git a/templates/services.php b/templates/services.php index 82807f2..6ef7121 100644 --- a/templates/services.php +++ b/templates/services.php @@ -1,5 +1,4 @@ @@ -57,9 +56,6 @@ foreach ($servicesData as $service) { "; } ?> - - -