sencha touch 手势识别左右滑动
生活随笔
收集整理的這篇文章主要介紹了
sencha touch 手势识别左右滑动
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
sencha touch 中添加手勢識別非常簡單,就是監聽 dom 元素的 move 事件:
1. 為你的 view 注冊 swipe 事件
// 為當前 view 注冊手勢滑動事件 Ext.get('myTouchView').on('swipe', 'onViewSwipe', this);2. 判斷滑動方向
// 手勢滑動監聽事件 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 元素有很多監聽事件:
touchstart ? touchend ?touchmove ?swipe ?dragstart
drag dragend tap doubletap longpress pinch rotate?
當然手勢識別通過監聽?touchmove 判斷開始和停止的坐標也可以實現。
詳細信息可以參考:sencha touch 文檔中的 Kitchen Sink 例子中的 Touch Events
?
?
?
?
轉載于:https://www.cnblogs.com/lesliefang/p/3477508.html
總結
以上是生活随笔為你收集整理的sencha touch 手势识别左右滑动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MVC-05 Model(1)
- 下一篇: element ui 上下箭头