如何在photoswipe中捕捉滑动事件?
我尝试了以下内容......
var pSwipe = window.Code.PhotoSwipe.attach($(arrGallery), options);
pSwipe.show(0);
pSwipe.addEventHandler(window.Code.PhotoSwipe.ActionTypes.swipeLeft, function (e) {
alert('swipe left');
});
但它没有抓住这个事件?
答案 0 :(得分:0)
以下是解决方案:
var pSwipe = window.Code.PhotoSwipe.attach($(arrGallery), options);
pSwipe.show(0);
pSwipe.addEventHandler(window.Code.PhotoSwipe.EventTypes.onTouch, function (e) {
switch (e.action) {
case 'swipeDown':
alert('you swiped down');
break;
case 'swipeUp':
alert('you swiped up');
break;
}
});