|
常规代码,并且需引入基本的
- <link rel="stylesheet" type="text/css" href="global/swiper.css"/>
- <script src="js/jquery-2.1.4.min.js" type="text/javascript" charset="utf-8"></script>
- <script src="global/swiper.min.js" type="text/javascript" charset="utf-8"></script>
复制代码- <section>
- <header class="door-style">产品展示</header>
- <!--lb-->
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div class="swiper-slide"><a href="#"><img src="images/lb.gif"/><span>混油玉兰白木门 简欧式油漆门</span></a></div>
- <div class="swiper-slide"><a href="#"><img src="images/lb.gif"/><span>混油玉兰白木门 简欧式油漆门1</span></a></div>
- <div class="swiper-slide"><a href="#"><img src="images/lb.gif"/><span>混油玉兰白木门 简欧式油漆门2</span></a></div>
- </div>
- <div class="swiper-pagination"></div>
- </div>
- <!--lb-->
-
- </section>
- <section>
- <header class="door-style">产品展示</header>
- <!--lb-->
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div class="swiper-slide"><a href="#"><img src="images/lb.gif"/><span>混油玉兰白木门 简欧式油漆门</span></a></div>
- <div class="swiper-slide"><a href="#"><img src="images/lb.gif"/><span>混油玉兰白木门 简欧式油漆门1</span></a></div>
- <div class="swiper-slide"><a href="#"><img src="images/lb.gif"/><span>混油玉兰白木门 简欧式油漆门2</span></a></div>
- </div>
- <div class="swiper-pagination"></div>
- </div>
- <!--lb-->
-
- </section>
复制代码
引入我写的js
- $(function(){
- //多个swiper一个页面
- $.extend({
- "swiperOption":function(f1,f2){
- new Swiper(f1, {
- pagination: f2,
- slidesPerView: 1,
- centeredSlides: true,
- paginationClickable: true,
- loop:true,
- autoplay: 2500,
- autoplayDisableOnInteraction: false,
- });
- },
- });
- $(".swiper-container").each(function(index){
- $.swiperOption($(this),$(this).find(".swiper-pagination"));
- });
- })
复制代码
|
|