2011-03-16 41 views

回答

7

如果我正確地理解了你,如果用戶將屏幕向左/右滑動屏幕,則要切換內容。我相信最簡單的方法是使用旋轉木馬。請看看在煎茶觸摸廚房水槽例如(用戶界面 - >旋轉木馬): http://dev.sencha.com/deploy/touch/examples/kitchensink/

下面是從Kitcen水槽採取了代碼示例,演示如何使用一個旋轉木馬的:

new Ext.Panel({ 
    cls: 'cards', 
    layout: { 
     type: 'vbox', 
     align: 'stretch' 
    }, 
    defaults: { 
     flex: 1 
    }, 
    items: [{ 
     xtype: 'carousel', 
     items: [{ 
      html: '<p>Navigate the carousel on this page by swiping left/right.</p>', 
      cls: 'card card1' 
     }, 
     { 
      html: '<p>Clicking on either side of the indicators below</p>', 
      cls: 'card card2' 
     }, 
     { 
      html: 'Card #3', 
      cls: 'card card3' 
     }] 
    }] 
}); 
+0

哇,謝謝你的分配! – 2011-03-19 21:07:24

+2

@Richard謝謝我的最佳方式就是接受答案! :) – Nicodemuz 2011-03-25 01:40:33

0

嗯......因此,在旋轉木馬上,如果想要捕捉該滑動事件,當用戶實際上從左向右滑動屏幕或從反向滑動屏幕捕捉該數據,並捕獲該數據以及該滑動方向時,該怎麼辦?

+1

對不起,沒關係。找到我正在尋找的東西: '聽衆:{'swipe':function(e,o){console.log('Yippee!I found it'); } } }' – Krishnan 2012-03-26 12:26:33

3

您可以添加類似這樣的手勢滑動事件。

tabpanel.element.on('swipe', function(e) { 
 
    if(e.direction === 'left') { 
 
    // left slide event here 
 
    } 
 
    if(e.direction === 'right') { 
 
    // right slide event here 
 
    } 
 
    if(e.direction === 'up') { 
 
    // up slide event here 
 
    } 
 
    if(e.direction === 'down') { 
 
    // down slide event here 
 
    } 
 
}, tabpanel);

希望這有助於你。