scrollbar.d.ts 2.2 KB

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