我已经为类似的需求做了类似的事情
window.mySwipe = new Swipe(document.getElementById('userSlider'), {
startSlide: 0,
speed: 400,
continuous: false,
disableScroll: false,
stopPropagation: false,
callback: function(index, elem) {
if(window.mySwipe.getPos() === 3){
setTimeout(function(){
$('#userSlider').fadeOut();
}, 500);
}
},
transitionEnd: function(index, elem) {}
});
你也可以这样做,达到同样的效果
window.mySwipe = new Swipe(document.getElementById('userSlider'), {
startSlide: 0,
speed: 400,
continuous: false,
disableScroll: false,
stopPropagation: false,
callback: function(index, elem) {},
transitionEnd: function(index, elem) {
if(window.mySwipe.getPos() === 3){
setTimeout(function(){
$('#userSlider').fadeOut();
}, 500);
}
}
});