UNPKG

2.06 kBTypeScriptView Raw
1import { CSSSelector } from '../shared';
2import Swiper from '../swiper-class';
3
4export interface ScrollbarMethods {
5 /**
6 * HTMLElement of Scrollbar container element
7 */
8 el: HTMLElement;
9
10 /**
11 * HTMLElement of Scrollbar draggable handler element
12 */
13 dragEl: HTMLElement;
14
15 /**
16 * Updates scrollbar track and handler sizes
17 */
18 updateSize(): void;
19}
20
21export interface ScrollbarEvents {
22 /**
23 * Event will be fired on draggable scrollbar drag start
24 */
25 scrollbarDragStart: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
26
27 /**
28 * Event will be fired on draggable scrollbar drag move
29 */
30 scrollbarDragMove: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
31
32 /**
33 * Event will be fired on draggable scrollbar drag end
34 */
35 scrollbarDragEnd: (swiper: Swiper, event: MouseEvent | TouchEvent | PointerEvent) => void;
36}
37
38/**
39 * Object with scrollbar parameters.
40 *
41 * @example
42 * var mySwiper = new Swiper('.swiper-container', {
43 * scrollbar: {
44 * el: '.swiper-scrollbar',
45 * draggable: true,
46 * },
47 * });
48 */
49export interface ScrollbarOptions {
50 /**
51 * String with CSS selector or HTML element of the container with scrollbar.
52 */
53 el?: CSSSelector | HTMLElement;
54
55 /**
56 * Hide scrollbar automatically after user interaction
57 *
58 * @default true
59 */
60 hide?: boolean;
61
62 /**
63 * Set to true to enable make scrollbar draggable that allows you to control slider position
64 *
65 * @default true
66 */
67 draggable?: boolean;
68
69 /**
70 * Set to true to snap slider position to slides when you release scrollbar
71 *
72 * @default false
73 */
74 snapOnRelease?: boolean;
75
76 /**
77 * Size of scrollbar draggable element in px
78 *
79 * @default 'auto'
80 */
81 dragSize?: 'auto' | number;
82
83 /**
84 * Scrollbar element additional CSS class when it is disabled
85 *
86 * @default 'swiper-scrollbar-lock'
87 */
88 lockClass?: string;
89
90 /**
91 * Scrollbar draggable element CSS class
92 *
93 * @default 'swiper-scrollbar-drag'
94 */
95 dragClass?: string;
96}