QQ客服
當前位置 : 中国福彩快乐十分开奖分布图 > 代碼 > 網頁特效 > 圖片代碼 > 基于swiper畫廊圖片切換代碼

质数分布图: 基于swiper畫廊圖片切換代碼

本例是基于swiper.js帶有縮略圖的畫廊布局切換特效。
分享到微信朋友圈
X

使用方法:

1、head引入css文件

<link href="css/swiper.css" rel="stylesheet">

<style type="text/css">
img{
	width: 100%;
}

#gallery {
	width: 1200px;
}

#thumbs {
	width: 1000px;
	margin-top: 50px;
}

#thumbs .swiper-slide {
	opacity: 0.3;
}

#thumbs .swiper-slide-thumb-active{
	opacity: 1;
}
</style>

2、body引入HTML代碼

<div class="swiper-container" id="gallery">
	<div class="swiper-wrapper">
		<div class="swiper-slide">
			<img src="img/img1.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img2.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img3.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img4.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img5.jpg" alt="輪播圖">
		</div>
	</div>
	<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>
</div>

<div class="swiper-container swiper-container-thumbs" id="thumbs">
	<div class="swiper-wrapper" style="transition-duration: 0ms;">
		<div class="swiper-slide">
			<img src="img/img1.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img2.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img3.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img4.jpg" alt="輪播圖">
		</div>
		<div class="swiper-slide">
			<img src="img/img5.jpg" alt="輪播圖">
		</div>
	</div>
	<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>
</div>

<script type="text/javascript" src="js/swiper.min.js"></script>
<script type="text/javascript">
var thumbsSwiper = new Swiper('#thumbs', {
	spaceBetween: 10,
	slidesPerView: 5,
	watchSlidesVisibility: true, //防止不可點擊
})
var gallerySwiper = new Swiper('#gallery', {
	effect : 'coverflow',
	spaceBetween: 10, //縮略圖間距
	slidesPerView: 3,
	centeredSlides: true,
	initialSlide :2,
	loop: true,
	autoplay: true,
	thumbs: {
		swiper: thumbsSwiper,
	}
})
</script>
[聲明]本站素材來自用戶分享,僅限學習交流請勿用于商業用途。如損害你的權益請聯系客服QQ:2447402004給予處理。
舉報×
舉報原因:
路爾軒 他的發布 已發布1

推薦標簽

相關代碼

二維碼
意見反饋
×
×

注冊

QQ注冊 立即下載 中国福彩快乐十分开奖分布图

簽到成功!

已連續簽到1天,簽到3天將獲得積分VIP1天

知道了