iT邦幫忙

0

Swiper嵌套式應用

  • 分享至 

  • xImage

https://ithelp.ithome.com.tw/upload/images/20210629/20138986AYSgnLJHRh.jpghttps://ithelp.ithome.com.tw/upload/images/20210629/20138986nFFYftVSaP.jpghttps://ithelp.ithome.com.tw/upload/images/20210629/20138986N12Ii1HwgH.jpg
是這樣的,小弟我是剛學習html的新手
然後我想要在嵌套式Swiper加上箭頭控制,但是箭頭出現後只能觸發一次
https://ithelp.ithome.com.tw/upload/images/20210629/20138986x3cQ59hcwQ.jpg
網路上找過後發現沒有相關的資源,希望各位邦友可以幫幫忙
html

<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
<div class="swiper-container swiper-container-h">
            <div class="swiper-wrapper">
            <div class="swiper-slide"><a href="o_01.html"><img src="images/O_smallpic.01.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_02.html"><img src="images/O_smallpic.02.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_03.html"><img src="images/O_smallpic.03.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_04.html"><img src="images/O_smallpic.04.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_05.html"><img src="images/O_smallpic.05.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_06.html"><img src="images/O_smallpic.06.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_07.html"><img src="images/O_smallpic.07.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_08.html"><img src="images/O_smallpic.08.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_09.html"><img src="images/O_smallpic.09.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_10.html"><img src="images/O_smallpic.10.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_11.html"><img src="images/O_smallpic.11.png" height="800px"></a></div>
            <div class="swiper-slide"><a href="o_12.html"><img src="images/O_smallpic.12.png" height="800px"></a></div>
            <div class="swiper-slide"> 
                <div class="swiper-container swiper-container-v">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"><a href="o_13.html"><img src="images/O_smallpic.13.png" height="800px"></a></div>
                            <div class="swiper-slide"><a href="o_22.html"><img src="images/O_smallpic.22.png" height="800px"></a></div>
                        </div>
                    </div>
                </div>
                <div class="swiper-slide"> 
                    <div class="swiper-container swiper-container-v">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"><a href="o_14.html"><img src="images/O_smallpic.14.png" height="800px"></a></div>
                            <div class="swiper-slide"><a href="o_23.html"><img src="images/O_smallpic.23.png" height="800px"></a></div>
                        </div>
                    </div>
                </div>
                <div class="swiper-slide"> 
                    <div class="swiper-container swiper-container-v">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"><a href="o_15.html"><img src="images/O_smallpic.15.png" height="800px"></a></div>
                            <div class="swiper-slide"><a href="o_24.html"><img src="images/O_smallpic.24.png" height="800px"></a></div>
                        </div>
                    </div>
                </div>
                <div class="swiper-slide"> 
                    <div class="swiper-container swiper-container-v">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"><a href="o_16.html"><img src="images/O_smallpic.16.png" height="800px"></a></div>
                            <div class="swiper-slide"><a href="o_25.html"><img src="images/O_smallpic.25.png" height="800px"></a></div>
                        </div>
                    </div>
                </div>
                <div class="swiper-slide"> 
                <div class="swiper-container swiper-container-v">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"><a href="o_17.html"><img src="images/O_smallpic.17.png" height="800px"></a></div>
                            <div class="swiper-slide"><a href="o_26.html"><img src="images/O_smallpic.26.png" height="800px"></a></div>
                        </div>
                    </div>
                </div>
                <div class="swiper-slide"><a href="o_11.html"><img src="images/O_smallpic.18.png" height="800px"></a></div>
                <div class="swiper-slide"><a href="o_12.html"><img src="images/O_smallpic.19.png" height="800px"></a></div>
                <div class="swiper-slide"><a href="o_11.html"><img src="images/O_smallpic.20.png" height="800px"></a></div>
                <div class="swiper-slide"><a href="o_12.html"><img src="images/O_smallpic.21.png" height="800px"></a></div>
            </div>
            <div class="swiper-button-next"></div>
            <div class="swiper-button-prev"></div>
        </div>
    </div>
    <script src="https://unpkg.com/swiper/swiper-bundle.min.js"> </script>

css

/*滑動*/
.swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 300ms;
    transform: scale(0.8);
  }
  .swiper-slide-active,.swiper-slide-duplicate-active{
    transform: scale(1);
  }
  .swiper-container {
    width: 100%;
    height: 100%;
  }

js

    var swiperH = new Swiper('.swiper-container-h', {
        slidesPerView: 3,
        spaceBetween: 30,
        centeredSlides: true,
        pagination: {
        el: '.swiper-pagination-h',
        dynamicBullets: true,
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
    });
    var swiperV = new Swiper('.swiper-container-v', {
      direction: 'vertical',
      spaceBetween: 30,
      pagination: {
        el: '.swiper-pagination-v',
        clickable: true,
      },
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
    });
可以不要用圖片來呈現你的程式嗎?這要大家回答時還要動手打字,我看到就懶了
非常抱歉!!!小弟我最近才得知這個論壇還不太能善用功能...馬上改進!!!
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0

我要發表回答

立即登入回答