document.addEventListener("DOMContentLoaded", function () { // MODAL JS const openModalButtons = document.querySelectorAll(".open-modal"); const closeModalButtons = document.querySelectorAll(".close-modal"); const modals = document.querySelectorAll(".modal"); openModalButtons.forEach(button => { button.addEventListener("click", (e) => { e.preventDefault(); // Prevent default anchor behavior const modalId = button.getAttribute("data-modal"); const modal = document.querySelector(modalId); modal.style.display = "block"; }); }); closeModalButtons.forEach(button => { button.addEventListener("click", () => { const modal = button.closest(".modal"); modal.style.display = "none"; }); }); window.addEventListener("click", (e) => { if (e.target.classList.contains("modal")) { e.target.style.display = "none"; } }); // PAGINATION JS let currentSlide = 0; const slides = document.querySelectorAll(".slide"); const dots = document.querySelectorAll(".dot"); function showSlide(index) { slides.forEach((slide, i) => { slide.classList.toggle("active", i === index); dots[i].classList.toggle("active", i === index); }); currentSlide = index; } setInterval(() => { let nextSlide = (currentSlide + 1) % slides.length; showSlide(nextSlide); }, 5000); // CONTACT US BUTTON - ALERT const contactForm = document.getElementById("contact-form"); if (contactForm) { contactForm.addEventListener("submit", function (event) { event.preventDefault(); const name = contactForm.querySelector('input[type="text"]').value; const email = contactForm.querySelector('input[type="email"]').value; const subject = contactForm.querySelector('input[placeholder="Subject"]').value; const message = contactForm.querySelector("textarea").value; if (name && email && subject && message) { alert("✅ - Message has been sent successfully! 😀"); contactForm.reset(); } else { alert("Please fill out all fields before submitting."); } }); } }); document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); // Prevent default anchor behavior const targetId = this.getAttribute('href'); // Get the target section ID const targetSection = document.querySelector(targetId); // Find the target section if (targetSection) { // Scroll to the target section smoothly targetSection.scrollIntoView({ behavior: 'smooth', block: 'start' }); } }); });