63 lines
2.0 KiB
JavaScript
63 lines
2.0 KiB
JavaScript
document.addEventListener("DOMContentLoaded", () => {
|
|
|
|
// ================== PROMOS CAROUSEL ==================
|
|
const promo = document.querySelectorAll(".promo-item");
|
|
let currentIndexPromo = 0;
|
|
|
|
function showNextPromo() {
|
|
promo.forEach(promo => {
|
|
promo.classList.remove("visible");
|
|
promo.style.display = "none";
|
|
});
|
|
|
|
promo[currentIndexPromo].classList.add("visible");
|
|
promo[currentIndexPromo].style.display = "block";
|
|
|
|
currentIndexPromo = (currentIndexPromo + 1) % promo.length;
|
|
}
|
|
|
|
showNextPromo();
|
|
setInterval(showNextPromo, 2250);
|
|
|
|
// ================== TESTIMONIALS CAROUSEL ==================
|
|
const testimonials = document.querySelectorAll(".testimonial-item");
|
|
let currentIndexTestimonials = 0;
|
|
|
|
function showNextTestimonial() {
|
|
testimonials.forEach(testimonial => {
|
|
testimonial.classList.remove("visible");
|
|
testimonial.style.display = "none";
|
|
});
|
|
|
|
testimonials[currentIndexTestimonials].classList.add("visible");
|
|
testimonials[currentIndexTestimonials].style.display = "block";
|
|
|
|
currentIndexTestimonials = (currentIndexTestimonials + 1) % testimonials.length;
|
|
}
|
|
|
|
showNextTestimonial();
|
|
setInterval(showNextTestimonial, 3500);
|
|
|
|
// ================== FEATURED ITEMS CAROUSEL ==================
|
|
const featuredItems = document.querySelectorAll(".featured-card");
|
|
let currentIndexFeatured = 0;
|
|
|
|
function updateFeaturedItems() {
|
|
featuredItems.forEach((item, index) => {
|
|
const text = item.closest('a');
|
|
if (text) text.style.display = (index === currentIndexFeatured ? "block" : "none");
|
|
|
|
const image = item;
|
|
image.style.display = (index === currentIndexFeatured ? "block" : "none");
|
|
});
|
|
}
|
|
|
|
function showNextFeatured() {
|
|
currentIndexFeatured = (currentIndexFeatured + 1) % featuredItems.length;
|
|
updateFeaturedItems();
|
|
}
|
|
|
|
updateFeaturedItems();
|
|
setInterval(showNextFeatured, 3000);
|
|
});
|