UNPKG

swiper

Version:

Most modern mobile touch slider and framework with hardware accelerated transitions

35 lines (29 loc) 880 B
export default function transitionEnd(runCallbacks, direction) { if (runCallbacks === void 0) { runCallbacks = true; } var swiper = this; var activeIndex = swiper.activeIndex, previousIndex = swiper.previousIndex, params = swiper.params; swiper.animating = false; if (params.cssMode) return; swiper.setTransition(0); var dir = direction; if (!dir) { if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset'; } swiper.emit('transitionEnd'); if (runCallbacks && activeIndex !== previousIndex) { if (dir === 'reset') { swiper.emit('slideResetTransitionEnd'); return; } swiper.emit('slideChangeTransitionEnd'); if (dir === 'next') { swiper.emit('slideNextTransitionEnd'); } else { swiper.emit('slidePrevTransitionEnd'); } } }