defaults.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. /**
  2. * Export default options.
  3. *
  4. * @author Naotoshi Fujita
  5. * @copyright Naotoshi Fujita. All rights reserved.
  6. */
  7. import { ELEMENT_CLASSES as classes } from "./classes";
  8. import { I18N as i18n } from './i18n';
  9. export const DEFAULTS = {
  10. /**
  11. * Determine a slider type.
  12. * - 'slide': Regular slider.
  13. * - 'loop' : Carousel slider.
  14. * - 'fade' : Change slides with fade transition. perPage, drag options are ignored.
  15. *
  16. * @type {string}
  17. */
  18. type: 'slide',
  19. /**
  20. * Whether to rewind a slider before the first slide or after the last one.
  21. * In "loop" mode, this option is ignored.
  22. *
  23. * @type {boolean}
  24. */
  25. rewind: false,
  26. /**
  27. * Transition speed in milliseconds.
  28. *
  29. * @type {number}
  30. */
  31. speed: 400,
  32. /**
  33. * Define slider max width.
  34. *
  35. * @type {number}
  36. */
  37. width: 0,
  38. /**
  39. * Fix width of slides. CSS format is allowed such as 10em, 80% or 80vw.
  40. * perPage number will be ignored when this option is falsy.
  41. *
  42. * @type {number|string}
  43. */
  44. fixedWidth: 0,
  45. /**
  46. * Fix height of slides. CSS format is allowed such as 10em, 80vh but % unit is not accepted.
  47. * heightRatio option will be ignored when this option is falsy.
  48. *
  49. * @type {number}
  50. */
  51. fixedHeight: 0,
  52. /**
  53. * Determine height of slides by ratio to a slider width.
  54. * This will be ignored when the fixedHeight is provided.
  55. *
  56. * @type {number}
  57. */
  58. heightRatio: 0,
  59. /**
  60. * Determine how many slides should be displayed per page.
  61. *
  62. * @type {number}
  63. */
  64. perPage: 1,
  65. /**
  66. * Determine how many slides should be moved when a slider goes to next or perv.
  67. *
  68. * @type {number}
  69. */
  70. perMove: 0,
  71. /**
  72. * Start index.
  73. *
  74. * @type {number}
  75. */
  76. start: 0,
  77. /**
  78. * Determine which slide should be focused if there are multiple slides in a page.
  79. * A string "center" is acceptable for centering slides.
  80. *
  81. * @type {number|string}
  82. */
  83. focus: 0,
  84. /**
  85. * Gap between slides. CSS format is allowed such as 1em.
  86. *
  87. * @type {number|string}
  88. */
  89. gap: 0,
  90. /**
  91. * Set padding-left/right in horizontal mode or padding-top/bottom in vertical one.
  92. * Give a single value to set a same size for both sides or
  93. * do an object for different sizes.
  94. * Also, CSS format is allowed such as 1em.
  95. *
  96. * @example
  97. * - 10: Number
  98. * - '1em': CSS format.
  99. * - { left: 0, right: 20 }: Object for different sizes in horizontal mode.
  100. * - { top: 0, bottom: 20 }: Object for different sizes in vertical mode.
  101. *
  102. * @type {number|string|Object}
  103. */
  104. padding: 0,
  105. /**
  106. * Whether to append arrows.
  107. *
  108. * @type {boolean}
  109. */
  110. arrows: true,
  111. /**
  112. * Change the arrow SVG path like 'm7.61 0.807-2.12...'.
  113. *
  114. * @type {string}
  115. */
  116. arrowPath: '',
  117. /**
  118. * Whether to append pagination(indicator dots) or not.
  119. *
  120. * @type {boolean}
  121. */
  122. pagination: true,
  123. /**
  124. * Activate autoplay.
  125. *
  126. * @type {boolean}
  127. */
  128. autoplay: false,
  129. /**
  130. * Autoplay interval in milliseconds.
  131. *
  132. * @type {number}
  133. */
  134. interval: 5000,
  135. /**
  136. * Whether to stop autoplay when a slider is hovered.
  137. *
  138. * @type {boolean}
  139. */
  140. pauseOnHover: true,
  141. /**
  142. * Whether to stop autoplay when a slider elements are focused.
  143. * True is recommended for accessibility.
  144. *
  145. * @type {boolean}
  146. */
  147. pauseOnFocus: true,
  148. /**
  149. * Loading images lazily.
  150. * Image src must be provided by a data-splide-src attribute.
  151. *
  152. * - false: Do nothing.
  153. * - 'nearby': Only images around an active slide will be loaded.
  154. * - 'sequential': All images will be sequentially loaded.
  155. *
  156. * @type {boolean|string}
  157. */
  158. lazyLoad: false,
  159. /**
  160. * This option works only when a lazyLoad option is "nearby".
  161. * Determine how many pages(not slides) around an active slide should be loaded beforehand.
  162. *
  163. * @type {number}
  164. */
  165. preloadPages: 1,
  166. /**
  167. * Easing for CSS transition. For example, linear, ease or cubic-bezier().
  168. *
  169. * @type {string}
  170. */
  171. easing: 'cubic-bezier(.42,.65,.27,.99)',
  172. /**
  173. * Whether to control a slide via keyboard.
  174. *
  175. * @type {boolean}
  176. */
  177. keyboard: true,
  178. /**
  179. * Whether to allow mouse drag and touch swipe.
  180. *
  181. * @type {boolean}
  182. */
  183. drag: true,
  184. /**
  185. * Threshold for determining if the action is "flick" or "swipe".
  186. * Around 0.5 is recommended.
  187. *
  188. * @type {number}
  189. */
  190. flickThreshold: .6,
  191. /**
  192. * Determine power of flick. The larger number this is, the farther a slider runs by flick.
  193. * Around 500 is recommended.
  194. *
  195. * @type {number}
  196. */
  197. flickPower: 600,
  198. /**
  199. * Limit a number of pages to move by flick.
  200. *
  201. * @type {number}
  202. */
  203. flickMaxPages: 1,
  204. /**
  205. * Slider direction.
  206. * - 'ltr': Left to right.
  207. * - 'rtl': Right to left.
  208. * - 'ttb': Top to bottom.
  209. *
  210. * @type {string}
  211. */
  212. direction: 'ltr',
  213. /**
  214. * Set img src to background-image of its parent element.
  215. * Images with various sizes can be displayed as same dimension without cropping step.
  216. * fixedHeight or heightRatio is required.
  217. *
  218. * @type {boolean}
  219. */
  220. cover: true,
  221. /**
  222. * Whether to enable accessibility(aria and screen reader texts) or not.
  223. *
  224. * @type {boolean}
  225. */
  226. accessibility: true,
  227. /**
  228. * Determine if a slider is navigation for another.
  229. * Use "sync" API to synchronize two sliders.
  230. *
  231. * @type {boolean}
  232. */
  233. isNavigation: false,
  234. /**
  235. * Whether to trim spaces before the fist slide or after the last one when "focus" is not 0.
  236. *
  237. * @type {boolean}
  238. */
  239. trimSpace: true,
  240. /**
  241. * Breakpoints definitions.
  242. *
  243. * @example
  244. * {
  245. * '1000': {
  246. * perPage: 3,
  247. * gap: 20
  248. * },
  249. * '600': {
  250. * perPage: 1,
  251. * gap: 5,
  252. * }
  253. * }
  254. *
  255. * @type {boolean|Object}
  256. */
  257. breakpoints: false,
  258. /**
  259. * Collection of class names.
  260. *
  261. * @see ./classes.js
  262. *
  263. * @type {Object}
  264. */
  265. classes,
  266. /**
  267. * Collection of i18n texts.
  268. *
  269. * @see ./i18n.js
  270. *
  271. * @type {Object}
  272. */
  273. i18n,
  274. };