35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
// Custom JS for Si-Apon
|
|
|
|
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');
|
|
if (contactForm) {
|
|
contactForm.addEventListener('submit', function (e) {
|
|
e.preventDefault();
|
|
// Basic validation
|
|
const name = document.getElementById('name').value;
|
|
const email = document.getElementById('email').value;
|
|
const message = document.getElementById('message').value;
|
|
|
|
if (name === '' || email === '' || message === '') {
|
|
alert('Please fill in all fields.');
|
|
} else {
|
|
// Here you would typically send the form data to the server
|
|
alert('Thank you for your message!');
|
|
contactForm.reset();
|
|
}
|
|
});
|
|
}
|
|
});
|