【发布时间】:2015-09-22 14:22:30
【问题描述】:
我在我的应用程序上使用 Swiper API。我想知道,我如何让用户一边浏览。我已阅读 (http://www.idangero.us/swiper/api/#.VgFind9VhBc) 上的文档,但没有找到答案。
【问题讨论】:
标签: jquery html browser swiper
我在我的应用程序上使用 Swiper API。我想知道,我如何让用户一边浏览。我已阅读 (http://www.idangero.us/swiper/api/#.VgFind9VhBc) 上的文档,但没有找到答案。
【问题讨论】:
标签: jquery html browser swiper
这是另一个例子:
swiper.on( 'slideChange', function() {
if ( swiper.activeIndex > swiper.previousIndex ) {
alert( 'left' );
} else {
alert( 'right' );
}
});
Swiper 对象内部有索引和其他信息。您不需要事件。
尝试查看对象:
console.log(swiper);
【讨论】:
你可以这样做:
galleryExample.on('slideChangeStart',function(event){
if(event.activeIndex > event.previousIndex){
alert('left');
}else{
alert('right');
}
});
event.activeIndex 是滑块的活动项目,event.previousIndex 是滑块之前所在项目的索引。
【讨论】: