【问题标题】:Bootstrap Carousel - Display All SlidesBootstrap 轮播 - 显示所有幻灯片
【发布时间】:2016-10-14 03:31:28
【问题描述】:

有没有办法像这样显示所有幻灯片:

可能是这张活动幻灯片的左右两边?

【问题讨论】:

    标签: html css carousel slideshow bootstrap-carousel


    【解决方案1】:

    我以前做的是使用这个脚本。

    <script>
    var slideIndex = 1;
    showDivs(slideIndex);
    
    function plusDivs(n) {
      showDivs(slideIndex += n);
    }
    
    function showDivs(n) {
      var i;
      var x = document.getElementsByClassName("mySlides");
      if (n > x.length) {slideIndex = 1}
      if (n < 1) {slideIndex = x.length}
      for (i = 0; i < x.length; i++) {
         x[i].style.display = "none";
      }
      x[slideIndex-1].style.display = "block";
    }
    </script>
    

    那么图片可以这样排列:

    <div class="YOUR PICTURE CLASS" style="max-width:800px;position:relative">
      <img class="mySlides" src="img_fjords.jpg" style="width:100%">
      <img class="mySlides" src="img_lights.jpg" style="width:100%">
      <img class="mySlides" src="img_mountains.jpg" style="width:100%">
      <img class="mySlides" src="img_forest.jpg" style="width:100%">
    
      <a class="w3-btn-floating" style="position:absolute;top:45%;left:0" onclick="plusDivs(-1)">❮</a>
      <a class="w3-btn-floating" style="position:absolute;top:45%;right:0" onclick="plusDivs(1)">❯</a>
    </div>
    

    您可以在此页面了解更多详情: http://www.w3schools.com/w3css/w3css_slideshow.asp

    【讨论】:

      【解决方案2】:

      使用光滑的滑块而不是引导轮播...并在中心模式下使用它 链接:http://kenwheeler.github.io/slick/ 在您的网站中包含 lib 文件后,它会像 jquery >> 中的那样: $('.center').slick({ 中心模式:真, centerPadding: '60px', 幻灯片显示:3, 响应:[ { 断点:768, 设置:{ 箭头:错误, 中心模式:真, centerPadding: '40px', 幻灯片放映:3 } }, { 断点:480, 设置:{ 箭头:错误, 中心模式:真, centerPadding: '40px', 幻灯片显示:1 } } ] });

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-01-15
        • 1970-01-01
        • 1970-01-01
        • 2018-06-02
        • 1970-01-01
        • 1970-01-01
        • 2021-12-03
        • 1970-01-01
        相关资源
        最近更新 更多