afterTransition(callback) { const handler = () => { callback(); this.$refs.carouselInner.removeEventListener('transitionend', handler); this.isTransitioning = false; }; this.$refs.carouselInner.addEventListener('transitionend', handler); }, withoutTransition(fn) { this.disableTransition(); fn(); this.$refs.carouselInner.offsetHeight; // Force reflow setTimeout(() => this.enableTransition(), 50); }, next() { if (this.isTransitioning) return; this.isTransitioning = true; this.currentSlide++; const maxIndex = this.originalSlides.length * 2; this.afterTransition(() => { if (this.currentSlide >= maxIndex) { this.withoutTransition(() => { this.currentSlide -= this.originalSlides.length; }); } }); }, prev() { if (this.isTransitioning) return; this.isTransitioning = true; this.currentSlide--; this.afterTransition(() => { if (this.currentSlide < this.originalSlides.length) { this.withoutTransition(() => { this.currentSlide += this.originalSlides.length; }); } }); },