本文爲H5EDU機構官方的HHTML5培訓教程 swiper教程。
本次內容咱們繼續介紹swiper當中的翻頁效果---3D翻轉效果
首先搭建swiper頁面,設置CSS樣式,爲了觀看效果,這一章依然在slide當中添加背景圖片。php
<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部分添加翻頁效果,進行初始化。app
var swiper = new Swiper('.swiper-container',{ pagination:'.swiper-pagination', nextButton:'.swiper-button-next', prevButton:'.swiper-button-prev', grabCursor:true, //抓手光標開啓 effect:'flip' //翻轉效果:3D翻轉
這樣一個帶有3D翻頁效果的頁面就完成了less
點擊進入swiper強化教程:http://h5edu.cn/index.php?c=index&a=step&lessonid=893ide