310-thumbs-gallery-loop.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Swiper demo</title>
  6. <meta
  7. name="viewport"
  8. content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"
  9. />
  10. <!-- Link Swiper's CSS -->
  11. <link
  12. rel="stylesheet"
  13. href="../swiper-bundle.min.css"
  14. />
  15. <!-- Demo styles -->
  16. <style>
  17. html,
  18. body {
  19. position: relative;
  20. height: 100%;
  21. }
  22. body {
  23. background: #eee;
  24. font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  25. font-size: 14px;
  26. color: #000;
  27. margin: 0;
  28. padding: 0;
  29. }
  30. .swiper {
  31. width: 100%;
  32. height: 100%;
  33. }
  34. .swiper-slide {
  35. text-align: center;
  36. font-size: 18px;
  37. background: #fff;
  38. /* Center slide text vertically */
  39. display: -webkit-box;
  40. display: -ms-flexbox;
  41. display: -webkit-flex;
  42. display: flex;
  43. -webkit-box-pack: center;
  44. -ms-flex-pack: center;
  45. -webkit-justify-content: center;
  46. justify-content: center;
  47. -webkit-box-align: center;
  48. -ms-flex-align: center;
  49. -webkit-align-items: center;
  50. align-items: center;
  51. }
  52. .swiper-slide img {
  53. display: block;
  54. width: 100%;
  55. height: 100%;
  56. object-fit: cover;
  57. }
  58. body {
  59. background: #000;
  60. color: #000;
  61. }
  62. .swiper {
  63. width: 100%;
  64. height: 300px;
  65. margin-left: auto;
  66. margin-right: auto;
  67. }
  68. .swiper-slide {
  69. background-size: cover;
  70. background-position: center;
  71. }
  72. .mySwiper2 {
  73. height: 80%;
  74. width: 100%;
  75. }
  76. .mySwiper {
  77. height: 20%;
  78. box-sizing: border-box;
  79. padding: 10px 0;
  80. }
  81. .mySwiper .swiper-slide {
  82. width: 25%;
  83. height: 100%;
  84. opacity: 0.4;
  85. }
  86. .mySwiper .swiper-slide-thumb-active {
  87. opacity: 1;
  88. }
  89. .swiper-slide img {
  90. display: block;
  91. width: 100%;
  92. height: 100%;
  93. object-fit: cover;
  94. }
  95. </style>
  96. </head>
  97. <body>
  98. <!-- Swiper -->
  99. <div
  100. style="--swiper-navigation-color: #fff; --swiper-pagination-color: #fff"
  101. class="swiper mySwiper2"
  102. >
  103. <div class="swiper-wrapper">
  104. <div class="swiper-slide">
  105. <img src="./images/nature-1.jpg" />
  106. </div>
  107. <div class="swiper-slide">
  108. <img src="./images/nature-2.jpg" />
  109. </div>
  110. <div class="swiper-slide">
  111. <img src="./images/nature-3.jpg" />
  112. </div>
  113. <div class="swiper-slide">
  114. <img src="./images/nature-4.jpg" />
  115. </div>
  116. <div class="swiper-slide">
  117. <img src="./images/nature-5.jpg" />
  118. </div>
  119. <div class="swiper-slide">
  120. <img src="./images/nature-6.jpg" />
  121. </div>
  122. <div class="swiper-slide">
  123. <img src="./images/nature-7.jpg" />
  124. </div>
  125. <div class="swiper-slide">
  126. <img src="./images/nature-8.jpg" />
  127. </div>
  128. <div class="swiper-slide">
  129. <img src="./images/nature-9.jpg" />
  130. </div>
  131. <div class="swiper-slide">
  132. <img src="./images/nature-10.jpg" />
  133. </div>
  134. </div>
  135. <div class="swiper-button-next"></div>
  136. <div class="swiper-button-prev"></div>
  137. </div>
  138. <div thumbsSlider="" class="swiper mySwiper">
  139. <div class="swiper-wrapper">
  140. <div class="swiper-slide">
  141. <img src="./images/nature-1.jpg" />
  142. </div>
  143. <div class="swiper-slide">
  144. <img src="./images/nature-2.jpg" />
  145. </div>
  146. <div class="swiper-slide">
  147. <img src="./images/nature-3.jpg" />
  148. </div>
  149. <div class="swiper-slide">
  150. <img src="./images/nature-4.jpg" />
  151. </div>
  152. <div class="swiper-slide">
  153. <img src="./images/nature-5.jpg" />
  154. </div>
  155. <div class="swiper-slide">
  156. <img src="./images/nature-6.jpg" />
  157. </div>
  158. <div class="swiper-slide">
  159. <img src="./images/nature-7.jpg" />
  160. </div>
  161. <div class="swiper-slide">
  162. <img src="./images/nature-8.jpg" />
  163. </div>
  164. <div class="swiper-slide">
  165. <img src="./images/nature-9.jpg" />
  166. </div>
  167. <div class="swiper-slide">
  168. <img src="./images/nature-10.jpg" />
  169. </div>
  170. </div>
  171. </div>
  172. <!-- Swiper JS -->
  173. <script src="../swiper-bundle.min.js"></script>
  174. <!-- Initialize Swiper -->
  175. <script>
  176. var swiper = new Swiper(".mySwiper", {
  177. loop: true,
  178. spaceBetween: 10,
  179. slidesPerView: 4,
  180. freeMode: true,
  181. watchSlidesProgress: true,
  182. });
  183. var swiper2 = new Swiper(".mySwiper2", {
  184. loop: true,
  185. spaceBetween: 10,
  186. navigation: {
  187. nextEl: ".swiper-button-next",
  188. prevEl: ".swiper-button-prev",
  189. },
  190. thumbs: {
  191. swiper: swiper,
  192. },
  193. });
  194. </script>
  195. </body>
  196. </html>