230-effect-cube.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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: 300px;
  32. height: 300px;
  33. position: absolute;
  34. left: 50%;
  35. top: 50%;
  36. margin-left: -150px;
  37. margin-top: -150px;
  38. }
  39. .swiper-slide {
  40. background-position: center;
  41. background-size: cover;
  42. }
  43. .swiper-slide img {
  44. display: block;
  45. width: 100%;
  46. }
  47. </style>
  48. </head>
  49. <body>
  50. <!-- Swiper -->
  51. <div class="swiper mySwiper">
  52. <div class="swiper-wrapper">
  53. <div class="swiper-slide">
  54. <img src="./images/nature-1.jpg" />
  55. </div>
  56. <div class="swiper-slide">
  57. <img src="./images/nature-2.jpg" />
  58. </div>
  59. <div class="swiper-slide">
  60. <img src="./images/nature-3.jpg" />
  61. </div>
  62. <div class="swiper-slide">
  63. <img src="./images/nature-4.jpg" />
  64. </div>
  65. </div>
  66. <div class="swiper-pagination"></div>
  67. </div>
  68. <!-- Swiper JS -->
  69. <script src="../swiper-bundle.min.js"></script>
  70. <!-- Initialize Swiper -->
  71. <script>
  72. var swiper = new Swiper(".mySwiper", {
  73. effect: "cube",
  74. grabCursor: true,
  75. cubeEffect: {
  76. shadow: true,
  77. slideShadows: true,
  78. shadowOffset: 20,
  79. shadowScale: 0.94,
  80. },
  81. pagination: {
  82. el: ".swiper-pagination",
  83. },
  84. });
  85. </script>
  86. </body>
  87. </html>