swiper监听滚动条_swiper插件怎么监听滑动事件?

var startY,startX,endX,endY;

var mySwiper = new Swiper('.swiper-container',{

preventClicks : true,

pagination: '.swiper-pagination',

paginationClickable: '.swiper-pagination',

preventLinksPropagation : true,

spaceBetween: 30,

effect: 'fade',

onSlideChangeEnd:function(swiper){

alert(swiper.activeIndex+'');

// swiper.activeIndex 这个就是索引, 从 0 开始! 可看一共有多少元素!

},

onTouchStart: function(swiper,event){

var touch = event.touches[0];

startY = touch.pageY;

startX = touch.pageX;

},

onTouchMove: function(swiper,event){

var touch = event.touches[0];

endX = touch.pageX-startX;

endY = touch.pageY-startY;

},

onTouchEnd: function(swiper){

你可能感兴趣的:(swiper监听滚动条)