首页 > 其他 > 详细

swiper 的左右箭头放到轮播外面

时间:2019-10-14 16:11:56      阅读:469      评论:0      收藏:0      [点我收藏+]
<!-- 增加一个father的包裹 -->
  <div class="swiper-father">
    <div class="swiper-container swiper-container1">
      <div class="swiper-wrapper">
        <div class="swiper-slide">slide1</div>
        <div class="swiper-slide">slide2</div>
        <div class="swiper-slide">slide3</div>
      </div>
      <!-- siwper原本的箭头放在这里 -->
      <!-- <div class="swiper-button-prev"></div>
            <div class="swiper-button-next"></div> -->
    </div>
    <!-- 我们把swiper 的箭头放到swiper 外面 -->
    <div class="swiper-button-prev swiper-button-prev1"></div>
    <div class="swiper-button-next swiper-button-next1"></div>
  </div>
.swiper-container {
    border: 1px solid red;
    width: 400px;
    height: 400px;
  }
 
  .swiper-slide {
    width: 400px;
    height: 400px;
    background: orange;
  }
 
  .swiper-father {
    width: 500px;
    height: 400px;
    border: 1px solid red;
    position: relative;
  }
var mySwiper = new Swiper(‘.swiper-container1‘, {
    direction: ‘horizontal‘,
    loop: false,
    navigation: {
      nextEl: ‘.swiper-button-next1‘,
      prevEl: ‘.swiper-button-prev1‘,
    },
 
  });

技术分享图片

 

swiper 的左右箭头放到轮播外面

原文:https://www.cnblogs.com/shark1100913/p/11671384.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!