注册 登录 充值会员 退出
毕业设计 PHP源码
充值

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

作者/代码整理:  (转载请附加本文地址,带有“懒人原生”字样的谢绝转载) 发布日期:2018-08-03
Swiper全屏自适应焦点图轮播代码
这是一款基于Swiper实现的全屏自适应焦点图轮播代码,点击箭头按钮或拖动图片左右滚动切换到中间展示大图。


js代码

<script type="text/javascript" src="js/swiper.min.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>