移动端swiper做页面切换,如何让做最后一页滑动时回到第一页
2个回答
展开全部
<div class="swiper-container swiper1">
<div class="arrows_left a_left1"><img src="images/bm_leftbtnpng.png" alt=""/></div>
<div class="swiper-wrapper">
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
</div>
<div class="arrows_right a_right1"><img src="images/bm_rightbtn.png" alt=""/></div>
</div>
/*
* swiper初始化
*/
var swiper1 = new Swiper('.swiper1', {
loop:false,
grabCursor: true,
onSlideChangeStart: function(){
var index=swiper1.activeSlide;
$(".p1").html(index+1);
swiper2.swipeTo (index);
},
onTouchEnd:function(){ /*手指滑动时,判断手指滑动的方向*/
// alert(swiper1.slides.length);
goprev(); /*上一篇*/
gonext(); /*下一篇*/
}
});
<div class="arrows_left a_left1"><img src="images/bm_leftbtnpng.png" alt=""/></div>
<div class="swiper-wrapper">
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
<div class="swiper-slide"> <img src="uploads/detail_pic.jpg" alt=""/> </div>
</div>
<div class="arrows_right a_right1"><img src="images/bm_rightbtn.png" alt=""/></div>
</div>
/*
* swiper初始化
*/
var swiper1 = new Swiper('.swiper1', {
loop:false,
grabCursor: true,
onSlideChangeStart: function(){
var index=swiper1.activeSlide;
$(".p1").html(index+1);
swiper2.swipeTo (index);
},
onTouchEnd:function(){ /*手指滑动时,判断手指滑动的方向*/
// alert(swiper1.slides.length);
goprev(); /*上一篇*/
gonext(); /*下一篇*/
}
});
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询