1 | import Swiper from '../swiper-class';
|
2 |
|
3 | export interface AutoplayMethods {
|
4 | /**
|
5 | * Whether autoplay enabled and running
|
6 | */
|
7 | running: boolean;
|
8 |
|
9 | /**
|
10 | * Whether autoplay is paused
|
11 | */
|
12 | paused: boolean;
|
13 |
|
14 | /**
|
15 | * Pause autoplay
|
16 | */
|
17 | pause(speed?: number): void;
|
18 |
|
19 | /**
|
20 | * Run the autoplay logic
|
21 | */
|
22 | run(): void;
|
23 |
|
24 | /**
|
25 | * Start autoplay
|
26 | */
|
27 | start(): boolean;
|
28 |
|
29 | /**
|
30 | * Stop autoplay
|
31 | */
|
32 | stop(): boolean;
|
33 | }
|
34 |
|
35 | export interface AutoplayEvents {
|
36 | /**
|
37 | * Event will be fired in when autoplay started
|
38 | */
|
39 | autoplayStart: (swiper: Swiper) => void;
|
40 | /**
|
41 | * Event will be fired when autoplay stopped
|
42 | */
|
43 | autoplayStop: (swiper: Swiper) => void;
|
44 | /**
|
45 | * Event will be fired on autoplay pause (on mouse/pointer enter), when `pauseOnMouseEnter` enabled
|
46 | */
|
47 | autoplayPause: (swiper: Swiper) => void;
|
48 | /**
|
49 | * Event will be fired on autoplay resume (on mouse/pointer leave), when `pauseOnMouseEnter` enabled
|
50 | */
|
51 | autoplayResume: (swiper: Swiper) => void;
|
52 | /**
|
53 | * Event will be fired when slide changed with autoplay
|
54 | */
|
55 | autoplay: (swiper: Swiper) => void;
|
56 | }
|
57 |
|
58 | /**
|
59 | * Object with autoplay parameters or boolean `true` to enable with default settings.
|
60 | *
|
61 | * @example
|
62 | * ```js
|
63 | * const swiper = new Swiper('.swiper', {
|
64 | * autoplay: {
|
65 | * delay: 5000,
|
66 | * },
|
67 | * });
|
68 | * ```
|
69 | */
|
70 | export interface AutoplayOptions {
|
71 | /**
|
72 | * Delay between transitions (in ms). If this parameter is not specified, auto play will be disabled
|
73 | *
|
74 | * If you need to specify different delay for specific slides you can do it by using
|
75 | * `data-swiper-autoplay` (in ms) attribute on slide.
|
76 | *
|
77 | * @example
|
78 | * ```html
|
79 | * <!-- hold this slide for 2 seconds -->
|
80 | * <div class="swiper-slide" data-swiper-autoplay="2000">
|
81 | * ```
|
82 | *
|
83 | * @default 3000
|
84 | */
|
85 | delay?: number;
|
86 |
|
87 | /**
|
88 | * Enable this parameter and autoplay will be stopped when it reaches last slide (has no effect in loop mode)
|
89 | *
|
90 | * @default false
|
91 | */
|
92 | stopOnLastSlide?: boolean;
|
93 |
|
94 | /**
|
95 | * Set to `false` and autoplay will not be disabled after user interactions (swipes),
|
96 | * it will be restarted every time after interaction
|
97 | *
|
98 | * @default true
|
99 | */
|
100 | disableOnInteraction?: boolean;
|
101 |
|
102 | /**
|
103 | * Enables autoplay in reverse direction
|
104 | *
|
105 | * @default false
|
106 | */
|
107 | reverseDirection?: boolean;
|
108 |
|
109 | /**
|
110 | * When enabled autoplay will wait for wrapper transition to continue.
|
111 | * Can be disabled in case of using Virtual Translate when your
|
112 | * slider may not have transition
|
113 | *
|
114 | * @default true
|
115 | */
|
116 | waitForTransition?: boolean;
|
117 |
|
118 | /**
|
119 | * When enabled autoplay will be paused on mouse enter over Swiper container. If `disableOnInteraction` is also enabled, it will stop autoplay instead of pause
|
120 | *
|
121 | * @default false
|
122 | */
|
123 | pauseOnMouseEnter?: boolean;
|
124 | }
|