swiper 调完接口不能翻页,点击下一页没反应,不能轮播;
点击,上一页,下一页后执行函数
<script src="../Scripts/swiper.min.js"></script>
<script>
function sow() {
var nowguid = $(".swiper-slide-active").attr('guid');
var li = $('.two').find('li')
li.each(function () {
if (this.getAttribute('guid') == nowguid) {
$(this).addClass('active').siblings('li').removeClass('active');
$(this).parent().parent().parent().find('.icon-jiantou').removeClass('icon-jiantou').addClass('icon-xiajiantou')
$(this).closest('.two').show();
return false
}
})
}
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
paginationClickable: true,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
parallax: true,
speed: 600,
observer: true,//调完接口不能翻页解决方法,修改swiper自己或子元素时,自动初始化swiper
observeParents: true,//调完接口不能翻页解决方法,修改swiper的父元素时,自动初始化swiper
onSlideNextEnd: function (swiper) {
sow()
},
onSlidePrevEnd: function (swiper) {
sow()
}
});
</script>