2014-07-05 114 views
0

如何捕獲photoswipe中的刷卡事件?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

這裏是解決方案:

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; 
    } 
});