特效介绍
模仿swiper官方论坛收费轮播效果的基于Swiper 4.0.5的中间大图两边小图的Swiper轮播切换代码,效果不错,响应式,虽然论坛不免费下载,但我爱模板网在这里免费提供给有需要的朋友。
使用方法
1、在head区域引入swiper.css和本轮播的样式文件
<link rel="stylesheet" href="http://www.5imoban.net/download/swiper/swiper-4.0.5.min.css"> <link rel="stylesheet" href="certify.css">
2、html代码:
<div id="certify"> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide"><img src="./certify01.png" /><p>非常难得又值钱的认证证书</p></div> <div class="swiper-slide"><img src="./certify02.png" /><p>深圳市优秀互联网企业认定证书</p></div> <div class="swiper-slide"><img src="./certify03.png" /><p>质量管理体系认证荣誉证书</p></div> <div class="swiper-slide"><img src="./certify04.png" /><p>计算机软件著作权登记证书</p></div> <div class="swiper-slide"><img src="./certify05.png" /><p>增值电信业务经营许可证</p></div> </div> </div> <div class="swiper-pagination"></div> <div class="swiper-button-prev"></div> <div class="swiper-button-next"></div> </div>
3、引入js
<script src="http://www.5imoban.net/download/swiper/swiper-4.0.5.min.js"></script>
4、初始化插件
var certifySwiper = new Swiper('#certify .swiper-container', { watchSlidesProgress: true, slidesPerView: 'auto', centeredSlides: true, loop: true, loopedSlides: 5, autoplay: true, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', //clickable :true, }, on: { progress: function(progress) { for (i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i); var slideProgress = this.slides[i].progress; modify = 1; if (Math.abs(slideProgress) > 1) { modify = (Math.abs(slideProgress) - 1) * 0.3 + 1; } translate = slideProgress * modify * 260 + 'px'; scale = 1 - Math.abs(slideProgress) / 5; zIndex = 999 - Math.abs(Math.round(10 * slideProgress)); slide.transform('translateX(' + translate + ') scale(' + scale + ')'); slide.css('zIndex', zIndex); slide.css('opacity', 1); if (Math.abs(slideProgress) > 3) { slide.css('opacity', 0); } } }, setTransition: function(transition) { for (var i = 0; i < this.slides.length; i++) { var slide = this.slides.eq(i) slide.transition(transition); } } } })