2013-04-04 33 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