1 | export default function transitionEmit({
|
2 | swiper,
|
3 | runCallbacks,
|
4 | direction,
|
5 | step
|
6 | }) {
|
7 | const {
|
8 | activeIndex,
|
9 | previousIndex
|
10 | } = swiper;
|
11 | let dir = direction;
|
12 |
|
13 | if (!dir) {
|
14 | if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
|
15 | }
|
16 |
|
17 | swiper.emit(`transition${step}`);
|
18 |
|
19 | if (runCallbacks && activeIndex !== previousIndex) {
|
20 | if (dir === 'reset') {
|
21 | swiper.emit(`slideResetTransition${step}`);
|
22 | return;
|
23 | }
|
24 |
|
25 | swiper.emit(`slideChangeTransition${step}`);
|
26 |
|
27 | if (dir === 'next') {
|
28 | swiper.emit(`slideNextTransition${step}`);
|
29 | } else {
|
30 | swiper.emit(`slidePrevTransition${step}`);
|
31 | }
|
32 | }
|
33 | } |
\ | No newline at end of file |