新年
快乐
Swiper全屏自适应焦点图轮播代码

Swiper全屏自适应焦点图轮播代码

Swiper全屏自适应焦点图轮播代码插图1

这是一款基于Swiper实现的全屏自适应焦点图轮播代码,点击箭头按钮或拖动图片左右滚动切换到中间展示大图。

js代码

<script type="text/javascript" src="https://img.x22t.com/file/2020/04/25/aeaf980f6942cae48830771430840a137427.js"></script>
<script type="text/javascript">
	window.onload = function() {
		var swiper = new Swiper(".swiper-container",{
			autoplay: false,
			speed: 1000,
			autoplayDisableOnInteraction: false,
			loop: true,
			centeredSlides: true,
			slidesPerView: 2,
			pagination: ".swiper-pagination",
			paginationClickable: true,
			prevButton: ".swiper-button-prev",
			nextButton: ".swiper-button-next",
			onInit: function(swiper) {
				swiper.slides[2].className = "swiper-slide swiper-slide-active";
			},
			breakpoints: {
				668: {
					slidesPerView: 1,
				}
			}
		});
	}
</script>

分享到 :
相关推荐

发表评论

邮箱地址不会被公开。 必填项已用*标注