我尝试在Sencha Touch或HTML5中从左到右执行滑动事件/效果。因此,如果超文本标记语言页面在iOS上运行,那么当用户在屏幕上用手指从左到右触摸和移动/滑动时,它应该会启动一个动画。
有什么想法可以“轻松”做到这一点吗?
发布于 2011-03-19 04:06:06
如果我没理解错的话,您希望在用户向左/向右滑动屏幕时切换内容。我认为最简单的方法是使用Carousel。请看一下Sencha Touch厨房水槽示例(用户界面-> Carousel):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'
}]
}]
});
发布于 2014-10-31 13:26:33
你可以添加类似这样的手势滑动事件。
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);
希望这能对你有所帮助。
发布于 2012-03-26 11:41:55
嗯..。那么,在旋转木马中,当用户从左向右或相反滑动屏幕时,如果想要捕捉滑动事件,该怎么办?并捕获这些数据,它被刷到了哪个方向?
https://stackoverflow.com/questions/5330825
复制