根据swiper官网提供的写法,
thumbs(缩略图)
<script language="javascript"> var thumbsSwiper = new Swiper('#thumbs',{ spaceBetween: 10, slidesPerView: 4, watchSlidesVisibility: true,//防止不可点击 }) var gallerySwiper = new Swiper('#gallery',{ spaceBetween: 10, thumbs: { swiper: thumbsSwiper, } }) </script>
缺少一个参数,所以缩略图高亮不跟随
slideThumbActiveClass: 'swiper-slide-thumb-active',
<script language="javascript"> var thumbsSwiper = new Swiper('#thumbs',{ spaceBetween: 10, slidesPerView: 4, watchSlidesVisibility: true,//防止不可点击 }) var gallerySwiper = new Swiper('#gallery',{ spaceBetween: 10, thumbs: { swiper: thumbsSwiper, slideThumbActiveClass: 'swiper-slide-thumb-active', } }) </script>
这样就可以了
标签:缩略图,spaceBetween,thumbs,new,var,slidesPerView,swiper From: https://www.cnblogs.com/zerozq/p/17525234.html