触摸滑动所有事件
TouchSwipe all events
我正在尝试处理函数中的事件。所以它在我的gameLogic函数中为每种类型的事件做了一些事情。
虽然,TAP没有得到认可。。。
我该怎么办?我应该把每个活动分开吗?
$(function() {
$(".main-wrapper-inner").swipe( {
//Generic swipe handler for all directions
tap:function(event, target) {
gameLogic("tap");
},
swipeLeft:function(event, distance, duration, fingerCount, fingerData) {
gameLogic("swipeLeft");
},
swipeRight:function(event, distance, duration, fingerCount, fingerData) {
gameLogic("swipeRight");
},
swipeUp:function(event, distance, duration, fingerCount, fingerData) {
gameLogic("swipeUp");
},
swipeDown:function(event, distance, duration, fingerCount, fingerData) {
gameLogic("swipeDown");
},
pinchIn:function(event, direction, distance, duration, fingerCount, pinchZoom, fingerData) {
gameLogic("pinchIn");
},
pinchOut:function(event, direction, distance, duration, fingerCount, pinchZoom, fingerData) {
gameLogic("pinchOut");
},
threshold:0,
fingers: 'all'
});
});
您可以获得滑动方向(但不能获得夹取方向),因此可以减少大量代码(见下文)。
关于点击,您不能将threshold: 0
设置为内部禁用所有点击/点击事件。将threshold
设置为高于0的任何值,或完全忽略它(默认为75),以使抽头功能在中工作
$(function() {
$(".main-wrapper-inner").swipe( {
//Generic swipe handler for all directions
tap:function(event, target) {
gameLogic("tap");
},
swipe(event, direction) {
// You can obtain the swipe direction
// and process it in your game logic
gameLogic("swipe", direction);
}
pinchIn:function(event) {
gameLogic("pinchIn");
},
pinchOut:function(event) {
gameLogic("pinchOut");
},
threshold: 75, // This must NOT be 0 for taps to work
fingers: 'all'
});
});
相关文章:
- 谷歌地图劫持了iphone's滚动(触摸事件)-如何恢复
- 如何在jquery中找到鼠标滚轮/触摸移动事件的走向
- 如何使用纯javascript的移动触摸事件
- 触摸启动事件未在iframe iOS 6中启动
- 如何检测滚动事件是否像在触摸设备上一样只触发一次
- 触摸滑动所有事件
- 移动定时触摸事件
- 模拟html5的触摸事件
- Phonegap/Cordova:如何添加Javascript多点触摸事件
- 如何在AngularJS中监听点击事件,而不是触摸事件
- 我可以让我的网站的内容可编辑区域对安卓股票浏览器上的触摸事件更敏感吗
- 当鼠标也在触摸另一个元素时,d3.js鼠标悬停事件未被触发
- 在 Firefox 中“解析”触摸事件
- 将触摸事件转换为鼠标事件仅每秒有效一次
- 在移动 Safari 上向下拖动时,触摸事件停止触发 - iPad HTML5
- 如何在 javascript 中触发触摸事件
- 为什么触摸事件不在手指按压的中间
- 如何启用离子多点触摸事件
- JavaScript事件.触摸数组
- D3鼠标事件触摸事件,即点击->支持触摸事件