2

我尝试在 Sencha Touch 或 HTML5 中从左到右进行滑动事件/效果。因此,如果 HTML 页面在 iOS 上运行,那么如果用户触摸 ans 并用手指在屏幕上从左向右移动/滑动,它应该启动动画。

有什么想法可以“轻松”完成吗?

4

3 回答 3

7

如果我理解正确,如果用户向左/向右滑动屏幕,您想要切换内容。我相信最简单的方法是使用轮播。请查看 Sencha Touch Kitchen Sink 示例(用户界面 -> 轮播): http ://dev.sencha.com/deploy/touch/examples/kitchensink/

下面是一个来自 Kitcen Sink 的代码示例,演示了 Carousel 的使用:

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'
        }]
    }]
});
于 2011-03-19T04:06:06.443 回答
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);

希望这对您有所帮助。

于 2014-10-31T13:26:32.820 回答
0

嗯...所以,在轮播中,如果想要捕获该滑动事件,当用户实际滑动屏幕时,从左到右或反之亦然...并同时捕获该数据,它是向哪个方向滑动的?

于 2012-03-26T11:41:54.743 回答