forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swiper.d.ts
196 lines (173 loc) · 5.64 KB
/
swiper.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// Type definitions for Swiper 2.0.0
// Project: https://github.com/nolimits4web/Swiper
// Definitions by: Sebastián Galiano <https://github.com/sgaliano/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface SwiperOptions {
speed?: number;
autoplay?: number;
mode?: string;
loop?: boolean;
loopAdditionalSlides?: number;
slidesPerView?: any;
slidesPerGroup?: number;
calculateHeight?: boolean;
updateOnImagesReady?: boolean;
releaseFormElements?: boolean;
watchActiveIndex?: boolean;
visibilityFullFit?: boolean;
autoResize?: boolean;
resizeReInit?: boolean;
DOMAnimation?: boolean;
resistance?: any;
noSwiping?: boolean;
preventLinks?: boolean;
initialSlide?: number;
useCSS3Transforms?: boolean;
// Free Mode and Scroll Container
freeMode?: boolean;
freeModeFluid?: boolean;
scrollContainer?: boolean;
momentumRatio?: number;
momentumBounce?: boolean;
momentumBounceRatio?: number;
// Slides offset
centeredSlides?: boolean;
offsetPxBefore?: number;
offsetPxAfter?: number;
offsetSlidesBefore?: number;
offsetSlidesAfter?: number;
// Touch/mouse interactions
touchRatio?: number;
simulateTouch?: boolean;
onlyExternal?: boolean;
followFinger?: boolean;
grabCursor?: boolean;
shortSwipes?: boolean;
moveStartThreshold?: number;
// Navigation
keyboardControl?: boolean;
mousewheelControl?: boolean;
nextButton?: string | HTMLElement;
prevButton?: string | HTMLElement;
// Pagination
pagination?: any;
paginationClickable?: boolean;
paginationAsRange?: boolean;
createPagination?: boolean;
// Namespace
wrapperClass?: string;
slideClass?: string;
slideActiveClass?: string;
slideVisibleClass?: string;
slideElement?: string;
noSwipingClass?: string;
paginationElement?: string;
paginationElementClass?: string;
paginationActiveClass?: string;
paginationVisibleClass?: string;
// Callbacks
queueStartCallbacks?: boolean;
queueEndCallbacks?: boolean;
onTouchStart?: (swiper: Swiper) => void;
onTouchMove?: (swiper: Swiper) => void;
onTouchEnd?: (swiper: Swiper) => void;
onSlideReset?: (swiper: Swiper) => void;
onSlideChangeStart?: (swiper: Swiper) => void;
onSlideChangeEnd?: (swiper: Swiper) => void;
onSlideClick?: (swiper: Swiper) => void;
onSlideTouch?: (swiper: Swiper) => void;
onImagesReady?: (swiper: Swiper) => void;
onMomentumBounce?: (swiper: Swiper) => void;
onResistanceBefore?: (swiper: Swiper, distance) => void;
onResistanceAfter?: (swiper: Swiper, distance) => void;
// Slides Loader
loader?: {
slides?: any[];
slidesHTMLType?: string;
surroundGroups?: number;
logic?: string;
loadAllSlides?: boolean;
};
// Plugins
scrollbar?: SwiperScrollbarOptions;
}
interface SwiperScrollbarOptions {
container: string; // Default: '.swiper-scrollbar'
draggable?: boolean; // Default: true
hide?: boolean; // Default: true
snapOnRelease?: boolean; // Default: false
}
declare class SwiperSlide {
append(): SwiperSlide;
clone(): SwiperSlide;
getWidth(): number;
getHeight(): number;
getOffset(): { top: number; left: number; };
insertAfter(index: number): SwiperSlide;
prepend(): SwiperSlide;
remove(): void;
}
declare class Swiper {
constructor(container: string|Element, options?: SwiperOptions);
// Properties
width: number;
height: number;
params;
positions;
// Feature detection
support: {
touch: boolean;
transforms: boolean;
transforms3d: boolean;
transitions: boolean;
};
// Browser detection
browser: {
ie8: boolean;
ie10: boolean;
};
// Navigation
activeIndex: number;
activeLoopIndex: number;
activeLoaderIndex: number;
previousIndex: number;
swipeNext(internal?: boolean): boolean;
swipePrev(internal?: boolean): boolean;
swipeReset(): boolean;
swipeTo(index: number, speed?: number, runCallbacks?: boolean): boolean;
activeSlide(): SwiperSlide;
updateActiveSlide(index: number): void;
// Events
touches;
isTouched: boolean;
clickedSlideIndex: number;
clickedSlide: SwiperSlide;
wrapperTransitionEnd(callback: () => void, permanent: boolean): void;
// Init/reset
destroy(removeResizeEvent?: boolean): void;
reInit(forceCalcSlides?: boolean): void;
resizeFix(reInit?: boolean): void;
// Autoplaying
autoplay: boolean;
startAutoplay(): void;
stopAutoplay(): void;
// Other methods
getWrapperTranslate(axis: string): number; // 'x' or 'y'
setWrapperTranslate(x: number, y: number, z: number): void;
setWrapperTransition(duration): void;
// Slides API
slides: SwiperSlide[];
createSlide(html: string, slideClassList?: string, element?: string): SwiperSlide;
appendSlide(html: string, slideClassList?: string, element?: string): SwiperSlide;
appendSlide(slideInstance: HTMLElement): SwiperSlide;
prependSlide(html: string, slideClassList?: string, element?: string): SwiperSlide;
prependSlide(slideInstance: HTMLElement): SwiperSlide;
insertSlideAfter(index: number, html: string, slideClassList?: string, element?: string): SwiperSlide;
insertSlideAfter(index: number, slideInstance: HTMLElement): SwiperSlide;
removeSlide(index: number): boolean;
removeLastSlide(): boolean;
removeAllSlides(): void;
getSlide(index: number): SwiperSlide;
getLastSlide(): SwiperSlide;
getFirstSlide(): SwiperSlide;
}