index.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Slick Playground</title>
  5. <meta charset="UTF-8">
  6. <link rel="stylesheet" type="text/css" href="./slick/slick.css">
  7. <link rel="stylesheet" type="text/css" href="./slick/slick-theme.css">
  8. <style type="text/css">
  9. html, body {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. * {
  14. box-sizing: border-box;
  15. }
  16. .slider {
  17. width: 50%;
  18. margin: 100px auto;
  19. }
  20. .slick-slide {
  21. margin: 0px 20px;
  22. }
  23. .slick-slide img {
  24. width: 100%;
  25. }
  26. .slick-prev:before,
  27. .slick-next:before {
  28. color: black;
  29. }
  30. .slick-slide {
  31. transition: all ease-in-out .3s;
  32. opacity: .2;
  33. }
  34. .slick-active {
  35. opacity: .5;
  36. }
  37. .slick-current {
  38. opacity: 1;
  39. }
  40. </style>
  41. </head>
  42. <body>
  43. <section class="vertical-center-4 slider">
  44. <div>
  45. <img src="http://placehold.it/350x100?text=1">
  46. </div>
  47. <div>
  48. <img src="http://placehold.it/350x100?text=2">
  49. </div>
  50. <div>
  51. <img src="http://placehold.it/350x100?text=3">
  52. </div>
  53. <div>
  54. <img src="http://placehold.it/350x100?text=4">
  55. </div>
  56. <div>
  57. <img src="http://placehold.it/350x100?text=5">
  58. </div>
  59. <div>
  60. <img src="http://placehold.it/350x100?text=6">
  61. </div>
  62. <div>
  63. <img src="http://placehold.it/350x100?text=7">
  64. </div>
  65. <div>
  66. <img src="http://placehold.it/350x100?text=8">
  67. </div>
  68. <div>
  69. <img src="http://placehold.it/350x100?text=9">
  70. </div>
  71. <div>
  72. <img src="http://placehold.it/350x100?text=10">
  73. </div>
  74. </section>
  75. <section class="vertical-center-3 slider">
  76. <div>
  77. <img src="http://placehold.it/350x100?text=1">
  78. </div>
  79. <div>
  80. <img src="http://placehold.it/350x100?text=2">
  81. </div>
  82. <div>
  83. <img src="http://placehold.it/350x100?text=3">
  84. </div>
  85. <div>
  86. <img src="http://placehold.it/350x100?text=4">
  87. </div>
  88. <div>
  89. <img src="http://placehold.it/350x100?text=5">
  90. </div>
  91. <div>
  92. <img src="http://placehold.it/350x100?text=6">
  93. </div>
  94. <div>
  95. <img src="http://placehold.it/350x100?text=7">
  96. </div>
  97. <div>
  98. <img src="http://placehold.it/350x100?text=8">
  99. </div>
  100. <div>
  101. <img src="http://placehold.it/350x100?text=9">
  102. </div>
  103. <div>
  104. <img src="http://placehold.it/350x100?text=10">
  105. </div>
  106. </section>
  107. <section class="vertical-center-2 slider">
  108. <div>
  109. <img src="http://placehold.it/350x100?text=1">
  110. </div>
  111. <div>
  112. <img src="http://placehold.it/350x100?text=2">
  113. </div>
  114. <div>
  115. <img src="http://placehold.it/350x100?text=3">
  116. </div>
  117. <div>
  118. <img src="http://placehold.it/350x100?text=4">
  119. </div>
  120. <div>
  121. <img src="http://placehold.it/350x100?text=5">
  122. </div>
  123. <div>
  124. <img src="http://placehold.it/350x100?text=6">
  125. </div>
  126. <div>
  127. <img src="http://placehold.it/350x100?text=7">
  128. </div>
  129. <div>
  130. <img src="http://placehold.it/350x100?text=8">
  131. </div>
  132. <div>
  133. <img src="http://placehold.it/350x100?text=9">
  134. </div>
  135. <div>
  136. <img src="http://placehold.it/350x100?text=10">
  137. </div>
  138. </section>
  139. <section class="vertical-center slider">
  140. <div>
  141. <img src="http://placehold.it/350x100?text=1">
  142. </div>
  143. <div>
  144. <img src="http://placehold.it/350x100?text=2">
  145. </div>
  146. <div>
  147. <img src="http://placehold.it/350x100?text=3">
  148. </div>
  149. <div>
  150. <img src="http://placehold.it/350x100?text=4">
  151. </div>
  152. <div>
  153. <img src="http://placehold.it/350x100?text=5">
  154. </div>
  155. <div>
  156. <img src="http://placehold.it/350x100?text=6">
  157. </div>
  158. <div>
  159. <img src="http://placehold.it/350x100?text=7">
  160. </div>
  161. <div>
  162. <img src="http://placehold.it/350x100?text=8">
  163. </div>
  164. <div>
  165. <img src="http://placehold.it/350x100?text=9">
  166. </div>
  167. <div>
  168. <img src="http://placehold.it/350x100?text=10">
  169. </div>
  170. </section>
  171. <section class="vertical slider">
  172. <div>
  173. <img src="http://placehold.it/350x100?text=1">
  174. </div>
  175. <div>
  176. <img src="http://placehold.it/350x100?text=2">
  177. </div>
  178. <div>
  179. <img src="http://placehold.it/350x100?text=3">
  180. </div>
  181. <div>
  182. <img src="http://placehold.it/350x100?text=4">
  183. </div>
  184. <div>
  185. <img src="http://placehold.it/350x100?text=5">
  186. </div>
  187. <div>
  188. <img src="http://placehold.it/350x100?text=6">
  189. </div>
  190. <div>
  191. <img src="http://placehold.it/350x100?text=7">
  192. </div>
  193. <div>
  194. <img src="http://placehold.it/350x100?text=8">
  195. </div>
  196. <div>
  197. <img src="http://placehold.it/350x100?text=9">
  198. </div>
  199. <div>
  200. <img src="http://placehold.it/350x100?text=10">
  201. </div>
  202. </section>
  203. <section class="regular slider">
  204. <div>
  205. <img src="http://placehold.it/350x300?text=1">
  206. </div>
  207. <div>
  208. <img src="http://placehold.it/350x300?text=2">
  209. </div>
  210. <div>
  211. <img src="http://placehold.it/350x300?text=3">
  212. </div>
  213. <div>
  214. <img src="http://placehold.it/350x300?text=4">
  215. </div>
  216. <div>
  217. <img src="http://placehold.it/350x300?text=5">
  218. </div>
  219. <div>
  220. <img src="http://placehold.it/350x300?text=6">
  221. </div>
  222. </section>
  223. <section class="center slider">
  224. <div>
  225. <img src="http://placehold.it/350x300?text=1">
  226. </div>
  227. <div>
  228. <img src="http://placehold.it/350x300?text=2">
  229. </div>
  230. <div>
  231. <img src="http://placehold.it/350x300?text=3">
  232. </div>
  233. <div>
  234. <img src="http://placehold.it/350x300?text=4">
  235. </div>
  236. <div>
  237. <img src="http://placehold.it/350x300?text=5">
  238. </div>
  239. <div>
  240. <img src="http://placehold.it/350x300?text=6">
  241. </div>
  242. <div>
  243. <img src="http://placehold.it/350x300?text=7">
  244. </div>
  245. <div>
  246. <img src="http://placehold.it/350x300?text=8">
  247. </div>
  248. <div>
  249. <img src="http://placehold.it/350x300?text=9">
  250. </div>
  251. </section>
  252. <section class="variable slider">
  253. <div>
  254. <img src="http://placehold.it/350x300?text=1">
  255. </div>
  256. <div>
  257. <img src="http://placehold.it/200x300?text=2">
  258. </div>
  259. <div>
  260. <img src="http://placehold.it/100x300?text=3">
  261. </div>
  262. <div>
  263. <img src="http://placehold.it/200x300?text=4">
  264. </div>
  265. <div>
  266. <img src="http://placehold.it/350x300?text=5">
  267. </div>
  268. <div>
  269. <img src="http://placehold.it/300x300?text=6">
  270. </div>
  271. </section>
  272. <section class="lazy slider" data-sizes="50vw">
  273. <div>
  274. <img data-lazy="http://placehold.it/350x300?text=1-350w" data-srcset="http://placehold.it/650x300?text=1-650w 650w, http://placehold.it/960x300?text=1-960w 960w" data-sizes="100vw">
  275. </div>
  276. <div>
  277. <img data-lazy="http://placehold.it/350x300?text=2-350w" data-srcset="http://placehold.it/650x300?text=2-650w 650w, http://placehold.it/960x300?text=2-960w 960w" data-sizes="100vw">
  278. </div>
  279. <div>
  280. <img data-lazy="http://placehold.it/350x300?text=3-350w" data-srcset="http://placehold.it/650x300?text=3-650w 650w, http://placehold.it/960x300?text=3-960w 960w" data-sizes="100vw">
  281. </div>
  282. <div>
  283. <img data-lazy="http://placehold.it/350x300?text=4-350w" data-srcset="http://placehold.it/650x300?text=4-650w 650w, http://placehold.it/960x300?text=4-960w 960w" data-sizes="100vw">
  284. </div>
  285. <div>
  286. <img data-lazy="http://placehold.it/350x300?text=5-350w" data-srcset="http://placehold.it/650x300?text=5-650w 650w, http://placehold.it/960x300?text=5-960w 960w" data-sizes="100vw">
  287. </div>
  288. <div>
  289. <!-- this slide should inherit the sizes attr from the parent slider -->
  290. <img data-lazy="http://placehold.it/350x300?text=6-350w" data-srcset="http://placehold.it/650x300?text=6-650w 650w, http://placehold.it/960x300?text=6-960w 960w">
  291. </div>
  292. </section>
  293. <script src="https://code.jquery.com/jquery-2.2.0.min.js" type="text/javascript"></script>
  294. <script src="./slick/slick.js" type="text/javascript" charset="utf-8"></script>
  295. <script type="text/javascript">
  296. $(document).on('ready', function() {
  297. $(".vertical-center-4").slick({
  298. dots: true,
  299. vertical: true,
  300. centerMode: true,
  301. slidesToShow: 4,
  302. slidesToScroll: 2
  303. });
  304. $(".vertical-center-3").slick({
  305. dots: true,
  306. vertical: true,
  307. centerMode: true,
  308. slidesToShow: 3,
  309. slidesToScroll: 3
  310. });
  311. $(".vertical-center-2").slick({
  312. dots: true,
  313. vertical: true,
  314. centerMode: true,
  315. slidesToShow: 2,
  316. slidesToScroll: 2
  317. });
  318. $(".vertical-center").slick({
  319. dots: true,
  320. vertical: true,
  321. centerMode: true,
  322. });
  323. $(".vertical").slick({
  324. dots: true,
  325. vertical: true,
  326. slidesToShow: 3,
  327. slidesToScroll: 3
  328. });
  329. $(".regular").slick({
  330. dots: true,
  331. infinite: true,
  332. slidesToShow: 3,
  333. slidesToScroll: 3
  334. });
  335. $(".center").slick({
  336. dots: true,
  337. infinite: true,
  338. centerMode: true,
  339. slidesToShow: 5,
  340. slidesToScroll: 3
  341. });
  342. $(".variable").slick({
  343. dots: true,
  344. infinite: true,
  345. variableWidth: true
  346. });
  347. $(".lazy").slick({
  348. lazyLoad: 'ondemand', // ondemand progressive anticipated
  349. infinite: true
  350. });
  351. });
  352. </script>
  353. </body>
  354. </html>