UNPKG

stylescape

Version:

Stylescape is a visual identity framework developed by Scape Agency.

31 lines 1.08 kB
export default class CarouselManager { constructor(containerId) { this.currentIndex = 0; this.container = document.getElementById(containerId); this.items = this.container.querySelectorAll(".carousel-item"); this.setupButtons(); } setupButtons() { document .getElementById("prevBtn") .addEventListener("click", () => this.movePrev()); document .getElementById("nextBtn") .addEventListener("click", () => this.moveNext()); } movePrev() { if (this.currentIndex > 0) { this.items[this.currentIndex].classList.remove("active"); this.currentIndex--; this.items[this.currentIndex].classList.add("active"); } } moveNext() { if (this.currentIndex < this.items.length - 1) { this.items[this.currentIndex].classList.remove("active"); this.currentIndex++; this.items[this.currentIndex].classList.add("active"); } } } //# sourceMappingURL=CarouselManager.js.map