sencha touch 手势识别左右滑动
生活随笔
收集整理的這篇文章主要介紹了
sencha touch 手势识别左右滑动
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
sencha touch 中添加手勢識別非常簡單,就是監(jiān)聽 dom 元素的 move 事件:
1. 為你的 view 注冊 swipe 事件
// 為當(dāng)前 view 注冊手勢滑動事件 Ext.get('myTouchView').on('swipe', 'onViewSwipe', this);2. 判斷滑動方向
// 手勢滑動監(jiān)聽事件 onViewSwipe : function(e, target, options, eOpts) {if (e.direction === 'left' && e.distance >= 20) {console.log('move left');} else if (e.direction === 'right' && e.distance >= 20) {console.log('move right');} }sencha touch 中 dom 元素有很多監(jiān)聽事件:
touchstart ? touchend ?touchmove ?swipe ?dragstart
drag dragend tap doubletap longpress pinch rotate?
當(dāng)然手勢識別通過監(jiān)聽?touchmove 判斷開始和停止的坐標(biāo)也可以實現(xiàn)。
詳細信息可以參考:sencha touch 文檔中的 Kitchen Sink 例子中的 Touch Events
?
?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/lesliefang/p/3477508.html
總結(jié)
以上是生活随笔為你收集整理的sencha touch 手势识别左右滑动的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MVC-05 Model(1)
- 下一篇: IIS8托管WCF服务