2024-08-09 06:21:29 +01:00
|
|
|
// Carousel Functionality
|
2024-05-26 03:59:54 +01:00
|
|
|
let currentIndex = 0;
|
|
|
|
let slides = document.getElementsByClassName("carousel-item");
|
|
|
|
let totalSlides = slides.length;
|
|
|
|
|
|
|
|
function showSlides() {
|
2024-08-09 06:21:29 +01:00
|
|
|
for (let i = 0; i < totalSlides; i++) {
|
|
|
|
slides[i].classList.remove("active");
|
|
|
|
}
|
|
|
|
currentIndex++;
|
|
|
|
if (currentIndex >= totalSlides) {
|
|
|
|
currentIndex = 0;
|
|
|
|
}
|
|
|
|
slides[currentIndex].classList.add("active");
|
|
|
|
setTimeout(showSlides, 3000); // Change image every 3 seconds
|
2024-05-26 03:59:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function moveSlides(n) {
|
2024-08-09 06:21:29 +01:00
|
|
|
currentIndex += n;
|
|
|
|
if (currentIndex >= totalSlides) {
|
|
|
|
currentIndex = 0;
|
|
|
|
} else if (currentIndex < 0) {
|
|
|
|
currentIndex = totalSlides - 1;
|
|
|
|
}
|
|
|
|
for (let i = 0; i < totalSlides; i++) {
|
|
|
|
slides[i].classList.remove("active");
|
|
|
|
}
|
|
|
|
slides[currentIndex].classList.add("active");
|
2024-05-26 03:59:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Initial call to start the slideshow
|
|
|
|
showSlides();
|
2024-05-26 23:46:50 +01:00
|
|
|
|
|
|
|
function toggleMenu() {
|
2024-08-09 06:21:29 +01:00
|
|
|
var x = document.getElementById("myTopnav");
|
|
|
|
if (x.className === "topnav") {
|
|
|
|
x.className += " responsive";
|
|
|
|
} else {
|
|
|
|
x.className = "topnav";
|
|
|
|
}
|
2024-05-26 23:46:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
2024-08-09 06:21:29 +01:00
|
|
|
var pathname = window.location.pathname;
|
|
|
|
var navLinks = document.querySelectorAll(".topnav a");
|
|
|
|
|
|
|
|
navLinks.forEach(function (link) {
|
|
|
|
if (link.getAttribute("href") === pathname.split("/").pop()) {
|
|
|
|
link.classList.add("active");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Contact Form Functionality with EmailJS
|
|
|
|
document.getElementById("contactForm").addEventListener("submit", function(event) {
|
|
|
|
event.preventDefault(); // Prevent the default form submission
|
|
|
|
|
|
|
|
// Initialize EmailJS
|
|
|
|
emailjs.init("BfYQtqbAmpqUEmFDF");
|
|
|
|
console.log("EmailJS initialized.");
|
|
|
|
|
|
|
|
// Prepare the template parameters
|
|
|
|
var templateParams = {
|
|
|
|
name: document.getElementById("name").value,
|
|
|
|
subject: document.getElementById("subject").value,
|
|
|
|
message: document.getElementById("message").value,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Send the email using EmailJS
|
|
|
|
emailjs.send("service_ksnq0rd", "template_d1jme4h", templateParams)
|
|
|
|
.then(function(response) {
|
|
|
|
console.log("Email sent successfully:", response.status, response.text);
|
|
|
|
alert("Message sent successfully!");
|
|
|
|
}, function(error) {
|
|
|
|
console.error("Failed to send message:", error);
|
|
|
|
alert("Failed to send message. Please try again later.");
|
|
|
|
});
|
2024-05-26 23:46:50 +01:00
|
|
|
});
|