我做了這樣的事情對於同樣需要
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);
}
}
});