2013-04-04 45 views

回答

12

一种方法是听swipe事件上的旋转木马项目使用Ext.event.Event.direction处理您刷卡的方向沿:

listeners: { 
    initialize: function(c) { 
     this.element.on({ 
      swipe: function(e, node, options) { 
       if(e.direction == "left") { 
        alert("Hey! I swipe left"); 
       } else { 
        alert("Hey! I swipe right"); 
       } 
      } 
     }); 
    } 
} 

工作演示:

+7

伟大的作品! tnx – 2013-04-04 14:17:49

+0

但它有时只工作。有时候这个滑动函数并不是呈现在我的案例中... – SSS 2013-05-28 11:06:40

+1

它应该是'else if(e.direction ==“right”)'而不是简单的'else {...}'。否则,只要您滑动到顶部,底部和右侧,该块就会被触发 – DuKes0mE 2014-11-30 18:36:00