320-multiple-swipers.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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: #eee;
  60. }
  61. .swiper {
  62. width: 100%;
  63. height: 300px;
  64. margin: 20px 0;
  65. }
  66. </style>
  67. </head>
  68. <body>
  69. <!-- Swiper -->
  70. <div class="swiper mySwiper">
  71. <div class="swiper-wrapper">
  72. <div class="swiper-slide">Slide 1</div>
  73. <div class="swiper-slide">Slide 2</div>
  74. <div class="swiper-slide">Slide 3</div>
  75. <div class="swiper-slide">Slide 4</div>
  76. <div class="swiper-slide">Slide 5</div>
  77. <div class="swiper-slide">Slide 6</div>
  78. <div class="swiper-slide">Slide 7</div>
  79. <div class="swiper-slide">Slide 8</div>
  80. <div class="swiper-slide">Slide 9</div>
  81. </div>
  82. <div class="swiper-pagination"></div>
  83. </div>
  84. <div class="swiper mySwiper2">
  85. <div class="swiper-wrapper">
  86. <div class="swiper-slide">Slide 1</div>
  87. <div class="swiper-slide">Slide 2</div>
  88. <div class="swiper-slide">Slide 3</div>
  89. <div class="swiper-slide">Slide 4</div>
  90. <div class="swiper-slide">Slide 5</div>
  91. <div class="swiper-slide">Slide 6</div>
  92. <div class="swiper-slide">Slide 7</div>
  93. <div class="swiper-slide">Slide 8</div>
  94. <div class="swiper-slide">Slide 9</div>
  95. </div>
  96. <div class="swiper-pagination"></div>
  97. </div>
  98. <div class="swiper mySwiper3">
  99. <div class="swiper-wrapper">
  100. <div class="swiper-slide">Slide 1</div>
  101. <div class="swiper-slide">Slide 2</div>
  102. <div class="swiper-slide">Slide 3</div>
  103. <div class="swiper-slide">Slide 4</div>
  104. <div class="swiper-slide">Slide 5</div>
  105. <div class="swiper-slide">Slide 6</div>
  106. <div class="swiper-slide">Slide 7</div>
  107. <div class="swiper-slide">Slide 8</div>
  108. <div class="swiper-slide">Slide 9</div>
  109. </div>
  110. <div class="swiper-pagination"></div>
  111. </div>
  112. <!-- Swiper JS -->
  113. <script src="../swiper-bundle.min.js"></script>
  114. <!-- Initialize Swiper -->
  115. <script>
  116. var swiper = new Swiper(".mySwiper", {
  117. spaceBetween: 30,
  118. pagination: {
  119. el: ".swiper-pagination",
  120. clickable: true,
  121. },
  122. });
  123. var swiper2 = new Swiper(".mySwiper2", {
  124. spaceBetween: 30,
  125. pagination: {
  126. el: ".swiper-pagination",
  127. clickable: true,
  128. },
  129. });
  130. var swiper3 = new Swiper(".mySwiper3", {
  131. spaceBetween: 30,
  132. pagination: {
  133. el: ".swiper-pagination",
  134. clickable: true,
  135. },
  136. });
  137. </script>
  138. </body>
  139. </html>