时间:2021-07-01 10:21:17 帮助过:70人阅读
<div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide"><img src="logo.png"></div> <div class="swiper-slide" style="background-image:url(img/4.jpg)"></div> <div class="swiper-slide" style="background-image:url(img/5.jpg)"></div> <div class="swiper-slide" style="background-image:url(img/6.jpg)"></div> </div> <div class="swiper-pagination"></div> <div class="swiper-button-next"></div> <div class="swiper-button-prev"></div> </div>
然后到js部分添加翻页效果,进行初始化。
var swiper = new Swiper('.swiper-container',{ pagination:'.swiper-pagination', nextButton:'.swiper-button-next', prevButton:'.swiper-button-prev', grabCursor:true, //抓手光标开启 effect:'flip' //翻转效果:3D翻转
这样一个带有3D翻页效果的页面就完成了
以上就是swiper的基础使用(十八)的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!