欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

設計SwiperJS的樣式以在任一側顯示部分幻燈片

錢斌斌1年前8瀏覽0評論

我正在尋找一點幫助來完成我的SwiperJS實現,以取代我的網站上的其他滑塊-目的是要有可變寬度的幻燈片-如果有一個橫向幻燈片在中心,然后顯示它和一點點的前面和后面的幻燈片在任何一邊,但如果是縱向的,那么多一點-圖像可能會使我的意思更清楚

我把SwiperJS設置成這樣——它可以工作,但一次只能顯示一張圖片,我還需要部分前面和后面的幻燈片來顯示,我猜它離它需要的位置只有一小步,但我無法解決它

<!DOCTYPE html>
 <html lang="en">

 <head>
  <meta charset="utf-8">
  <title>Swiper demo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

  <!-- Link Swiper's CSS -->
  <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">

  <!-- Demo styles -->
  <style>
    html,
    body {
      position: relative;
      height: 400px;
    }

    body {
      background: #eee;
      font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
      font-size: 14px;
      color: #000;
      margin: 0;
      padding: 0;
    }

    .swiper-container {
      width: 100%;
      height: 100%;
      background-color:#ffcc00;
    }

    .swiper-slide {width:100%;height:100%;}

    .swiper-slide img {
      height:100%;
    }
   </style>
 </head>

 <body>
   <!-- Swiper -->
   <div class="swiper-container">
     <div class="swiper-wrapper">
       <div class="swiper-slide"><img src='https://via.placeholder.com/900x600.png?text=900x600'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/600x900.png?text=600x900'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/900x600.png?text=900x600'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/900x600.png?text=900x600'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/600x900.png?text=600x900'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/900x600.png?text=900x600'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/600x900.png?text=600x900'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/600x900.png?text=600x900'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/600x900.png?text=600x900'></div>
       <div class="swiper-slide"><img src='https://via.placeholder.com/600x900.png?text=600x900'></div>
    </div>
    <!-- Add Pagination -->
    <div class="swiper-pagination"></div>
 <div class="swiper-button-prev" tabindex="0" role="button" aria-label="Previous slide" aria-     controls="swiper-wrapper-181ef273d22e62b1"></div>
  <div class="swiper-button-next" tabindex="0" role="button" aria-label="Next slide" aria-     controls="swiper-wrapper-181ef273d22e62b1"></div>
  </div>

  <!-- Swiper JS -->
  <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

  <!-- Initialize Swiper -->
  <script>
    var swiper = new Swiper('.swiper-container', {
      slidesPerView: 'auto',
      spaceBetween: 30,
      loop: true,
      loopFillGroupWithBlank: true,
      pagination: {
         el: '.swiper-pagination',
        clickable: true,
      },
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
    });
  </script>
</body>

</html>

滑塊中的橫向圖像,兩側有部分幻燈片

滑塊中的縱向圖像,兩側有部分幻燈片

我覺得你應該試試slidePerView: 2.5: https://stackblitz.com/edit/7z4hsr-ld2tx8?file=index.html

或者指定幻燈片寬度: https://stackblitz.com/edit/7z4hsr?file=index.html

new Swiper('.swiper-container', {
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        slidesPerView: 2.5,
        spaceBetween: 30,
        watchSlidesVisibility: true,
    });

.swiper-slide {
  padding-block: 110px;
  text-align: center;
  font-size: 18px;
  background: #ccc;
}

<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.min.js"></script>
<link  rel="stylesheet"/>
<div class="container">   
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
            <div class="swiper-slide">Slide 4</div>
            <div class="swiper-slide">Slide 5</div>
            <div class="swiper-slide">Slide 6</div>
        </div>

        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>
    </div>
</div>