stylescape
Version:
Stylescape is a visual identity framework developed by Scape Agency.
19 lines • 644 B
JavaScript
export default class GalleryManager {
constructor(gallerySelector) {
this.currentIndex = 0;
this.images = document.querySelectorAll(`${gallerySelector} img`);
this.images.forEach((image, index) => {
image.addEventListener("click", () => this.selectImage(index));
});
}
selectImage(index) {
this.currentIndex = index;
}
nextImage() {
this.selectImage((this.currentIndex + 1) % this.images.length);
}
prevImage() {
this.selectImage((this.currentIndex - 1 + this.images.length) % this.images.length);
}
}
//# sourceMappingURL=GalleryManager.js.map