UNPKG

2.03 kBTypeScriptView Raw
1import Swiper from '../swiper-class';
2
3export interface AutoplayMethods {
4 /**
5 * Whether autoplay enabled and running
6 */
7 running: boolean;
8
9 /**
10 * Start autoplay
11 */
12 start(): boolean;
13
14 /**
15 * Stop autoplay
16 */
17 stop(): boolean;
18}
19
20export interface AutoplayEvents {
21 /**
22 * Event will be fired in when autoplay started
23 */
24 autoplayStart: (swiper: Swiper) => void;
25 /**
26 * Event will be fired when autoplay stopped
27 */
28 autoplayStop: (swiper: Swiper) => void;
29 /**
30 * Event will be fired when slide changed with autoplay
31 */
32 autoplay: (swiper: Swiper) => void;
33}
34
35/**
36 * Object with autoplay parameters or boolean true to enable with default settings.
37 *
38 * @example
39 * var mySwiper = new Swiper('.swiper-container', {
40 * autoplay: {
41 * delay: 5000,
42 * },
43 * });
44 */
45export interface AutoplayOptions {
46 /**
47 * Delay between transitions (in ms). If this parameter is not specified, auto play will be disabled
48 *
49 * If you need to specify different delay for specifi slides you can do it by using
50 * data-swiper-autoplay (in ms) attribute on slide.
51 *
52 * @example
53 * <!-- hold this slide for 2 seconds -->
54 * <div class="swiper-slide" data-swiper-autoplay="2000">
55 *
56 * @default 3000
57 */
58 delay?: number;
59
60 /**
61 * Enable this parameter and autoplay will be stopped when it reaches last slide (has no effect in loop mode)
62 *
63 * @default false
64 */
65 stopOnLastSlide?: boolean;
66
67 /**
68 * Set to false and autoplay will not be disabled after
69 * user interactions (swipes), it will be restarted
70 * every time after interaction
71 *
72 * @default true
73 */
74 disableOnInteraction?: boolean;
75
76 /**
77 * Enables autoplay in reverse direction
78 *
79 * @default false
80 */
81 reverseDirection?: boolean;
82
83 /**
84 * When enabled autoplay will wait for wrapper transition to continue.
85 * Can be disabled in case of using Virtual Translate when your
86 * slider may not have transition
87 *
88 * @default true
89 */
90 waitForTransition?: boolean;
91}