You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
668 B
36 lines
668 B
|
3 years ago
|
export default function transitionEmit({
|
||
|
|
swiper,
|
||
|
|
runCallbacks,
|
||
|
|
direction,
|
||
|
|
step
|
||
|
|
}) {
|
||
|
|
const {
|
||
|
|
activeIndex,
|
||
|
|
previousIndex
|
||
|
|
} = swiper;
|
||
|
|
let dir = direction;
|
||
|
|
|
||
|
|
if (!dir) {
|
||
|
|
if (activeIndex > previousIndex) dir = 'next';
|
||
|
|
else if (activeIndex < previousIndex) dir = 'prev';
|
||
|
|
else dir = 'reset';
|
||
|
|
}
|
||
|
|
|
||
|
|
swiper.emit(`transition${step}`);
|
||
|
|
|
||
|
|
if (runCallbacks && activeIndex !== previousIndex) {
|
||
|
|
if (dir === 'reset') {
|
||
|
|
swiper.emit(`slideResetTransition${step}`);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
swiper.emit(`slideChangeTransition${step}`);
|
||
|
|
|
||
|
|
if (dir === 'next') {
|
||
|
|
swiper.emit(`slideNextTransition${step}`);
|
||
|
|
} else {
|
||
|
|
swiper.emit(`slidePrevTransition${step}`);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|