2025-10-31 12:07:56 +00:00

24 lines
718 B
JavaScript

// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Add a shadow to the navbar when scrolling
window.addEventListener('scroll', function() {
const navbar = document.querySelector('.navbar');
if (window.scrollY > 50) {
navbar.style.boxShadow = '0 2px 15px rgba(0,0,0,0.1)';
navbar.style.backgroundColor = 'white';
} else {
navbar.style.boxShadow = 'none';
navbar.style.backgroundColor = 'transparent';
}
});