123456789101112131415161718192021222324252627282930313233343536 |
- export default function effectVirtualTransitionEnd(_ref) {
- let {
- swiper,
- duration,
- transformEl,
- allSlides
- } = _ref;
- const {
- slides,
- activeIndex,
- $wrapperEl
- } = swiper;
- if (swiper.params.virtualTranslate && duration !== 0) {
- let eventTriggered = false;
- let $transitionEndTarget;
- if (allSlides) {
- $transitionEndTarget = transformEl ? slides.find(transformEl) : slides;
- } else {
- $transitionEndTarget = transformEl ? slides.eq(activeIndex).find(transformEl) : slides.eq(activeIndex);
- }
- $transitionEndTarget.transitionEnd(() => {
- if (eventTriggered) return;
- if (!swiper || swiper.destroyed) return;
- eventTriggered = true;
- swiper.animating = false;
- const triggerEvents = ['webkitTransitionEnd', 'transitionend'];
- for (let i = 0; i < triggerEvents.length; i += 1) {
- $wrapperEl.trigger(triggerEvents[i]);
- }
- });
- }
- }
|