24 lines
762 B
JavaScript
24 lines
762 B
JavaScript
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
// 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'
|
|
});
|
|
});
|
|
});
|
|
|
|
// Contact form validation
|
|
const contactForm = document.getElementById('contactForm');
|
|
contactForm.addEventListener('submit', function(event) {
|
|
if (!contactForm.checkValidity()) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
contactForm.classList.add('was-validated');
|
|
}, false);
|
|
});
|