Home >Web Front-end >HTML Tutorial >Basic use of swiper (14)
In this content, we introduce how to enable loop mode in the swiper page.
First, let us build a basic swiper layout using the skills accumulated in fourteen... or thirteen sessions. And set CSS styles as needed.
<div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide">H5EDU 1<img src="logo.png"></div> <div class="swiper-slide">H5EDU 2<img src="logo.png"></div> <div class="swiper-slide">H5EDU 3<img src="logo.png"></div> <div class="swiper-slide">H5EDU 4<img src="logo.png"></div> <div class="swiper-slide">H5EDU 5<img src="logo.png"></div> <div class="swiper-slide">H5EDU 6<img src="logo.png"></div> </div> <div class="swiper-pagination"></div> <div class="swiper-button-next"></div> <div class="swiper-button-prev"></div> </div>
Then go to js to initialize the page, and add our loop attribute (loop: true).
var swiper = new Swiper('.swiper-container',{ pagination:'.swiper-pagination', paginationClickable:true, nextButton:'.swiper-button-next', prevButton:'.swiper-button-prev', slidesPerView:1, spaceBetween:30, loop:true //开启循环属性 });
After completion, we can keep flipping Page, I can play for three days and three nights without getting tired!
The above is the basic use of swiper (14). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!