MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / updateCarousel

Function updateCarousel

docs/script.js:90–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88 let autoPlayInterval = null;
89
90 function updateCarousel() {
91 const translateX = -currentSlide * 100;
92 carouselTrack.style.transform = `translate3d(${translateX}%, 0, 0)`;
93
94 carouselDots.forEach((dot, index) => {
95 if (index === currentSlide) {
96 dot.classList.add("active");
97 } else {
98 dot.classList.remove("active");
99 }
100 });
101
102 // Update text content below carousel
103 const activeSlide = carouselTrack.querySelector(`[data-slide-index="${currentSlide}"]`);
104 const titleEl = document.getElementById("carouselTitle");
105 const descriptionEl = document.getElementById("carouselDescription");
106
107 if (activeSlide && titleEl && descriptionEl) {
108 const title = activeSlide.getAttribute("data-title");
109 const description = activeSlide.getAttribute("data-description");
110
111 if (title) {
112 titleEl.style.opacity = "0";
113 setTimeout(() => {
114 titleEl.textContent = title;
115 titleEl.style.opacity = "1";
116 }, 150);
117 }
118
119 if (description) {
120 descriptionEl.style.opacity = "0";
121 setTimeout(() => {
122 descriptionEl.textContent = description;
123 descriptionEl.style.opacity = "1";
124 }, 150);
125 }
126 }
127 }
128
129 function nextSlide() {
130 currentSlide = (currentSlide + 1) % totalSlides;

Callers 4

nextSlideFunction · 0.85
prevSlideFunction · 0.85
goToSlideFunction · 0.85
script.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected