微件:轮播

来自MCG大图书馆
<script src="https://sf.akass.cn/Swiper/8.1.5/swiper-bundle.min.js"></script> <script> function loadStyleSheet(url){

   var link = document.createElement('link');
   link.type = 'text/css';
   link.rel = 'stylesheet';
   link.href = url;
   document.getElementsByTagName('head')[0].appendChild(link);
}

loadStyleSheet("https://sf.akass.cn/Swiper/8.1.5/swiper-bundle.min.css");

var wid;

var mySwiper = new Swiper ('.mySwiper', {

   watchSlidesProgress: true,
   slidesPerView: 'auto',
   centeredSlides: true,
   loopedSlides: 3,
   observer:true,
   observeParents:true,
   onInit: function(swiper){
    wid = $(window).width(),
    swiper.setWrapperTranslate('-'+wid);
   },
   autoplay: true,
   loop: true, // 循环模式选项
   // 如果需要分页器
   pagination: {
     el: '.swiper-pagination',
   },
   // 如果需要前进后退按钮
   navigation: {
     nextEl: ".swiper-button-next",
     prevEl: ".swiper-button-prev",
   },
}) </script>