220-effect-fade.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. background-position: center;
  36. background-size: cover;
  37. }
  38. .swiper-slide img {
  39. display: block;
  40. width: 100%;
  41. }
  42. </style>
  43. </head>
  44. <body>
  45. <!-- Swiper -->
  46. <div class="swiper mySwiper">
  47. <div class="swiper-wrapper">
  48. <div class="swiper-slide">
  49. <img src="./images/nature-1.jpg" />
  50. </div>
  51. <div class="swiper-slide">
  52. <img src="./images/nature-2.jpg" />
  53. </div>
  54. <div class="swiper-slide">
  55. <img src="./images/nature-3.jpg" />
  56. </div>
  57. <div class="swiper-slide">
  58. <img src="./images/nature-4.jpg" />
  59. </div>
  60. </div>
  61. <div class="swiper-button-next"></div>
  62. <div class="swiper-button-prev"></div>
  63. <div class="swiper-pagination"></div>
  64. </div>
  65. <!-- Swiper JS -->
  66. <script src="../swiper-bundle.min.js"></script>
  67. <!-- Initialize Swiper -->
  68. <script>
  69. var swiper = new Swiper(".mySwiper", {
  70. spaceBetween: 30,
  71. effect: "fade",
  72. navigation: {
  73. nextEl: ".swiper-button-next",
  74. prevEl: ".swiper-button-prev",
  75. },
  76. pagination: {
  77. el: ".swiper-pagination",
  78. clickable: true,
  79. },
  80. });
  81. </script>
  82. </body>
  83. </html>