Skip to content

Commit

Permalink
Create script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
soham0028 authored Oct 7, 2024
1 parent 8139238 commit 5bb609a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Add any interactive features or animations here

document.addEventListener('DOMContentLoaded', () => {
// Example: Smooth scroll to section
const navLinks = document.querySelectorAll('nav ul li a');
navLinks.forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault();
const targetId = link.getAttribute('href').substring(1);
const targetSection = document.getElementById(targetId);
window.scrollTo({
top: targetSection.offsetTop,
behavior: 'smooth'
});
});
});
});

0 comments on commit 5bb609a

Please sign in to comment.