From be4052dd4abefbfe6c8c1bfda4856529ec4a59f6 Mon Sep 17 00:00:00 2001 From: KIRAN B <94750356+Kiran18b@users.noreply.github.com> Date: Tue, 13 Aug 2024 21:25:28 +0530 Subject: [PATCH] Create script.js --- script.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 script.js diff --git a/script.js b/script.js new file mode 100644 index 0000000..eb386ef --- /dev/null +++ b/script.js @@ -0,0 +1,9 @@ +// Example: Smooth scroll to sections +document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + e.preventDefault(); + document.querySelector(this.getAttribute('href')).scrollIntoView({ + behavior: 'smooth' + }); + }); +});