当前位置:网站首页>JS Touch
JS Touch
2022-06-10 17:50:00 【SeriousLose】
$("body").on("touchstart", function(e) {
e.preventDefault();
startX = e.originalEvent.changedTouches[0].pageX,
startY = e.originalEvent.changedTouches[0].pageY;
});
$("body").on("touchmove", function(e) {
e.preventDefault();
moveEndX = e.originalEvent.changedTouches[0].pageX,
moveEndY = e.originalEvent.changedTouches[0].pageY,
X = moveEndX - startX,
Y = moveEndY - startY;
if ( Math.abs(X) > Math.abs(Y) && X > 0 ) {
alert("left 2 right");
}
else if ( Math.abs(X) > Math.abs(Y) && X < 0 ) {
alert("right 2 left");
}
else if ( Math.abs(Y) > Math.abs(X) && Y > 0) {
alert("top 2 bottom");
}
else if ( Math.abs(Y) > Math.abs(X) && Y < 0 ) {
alert("bottom 2 top");
}
else{
alert("just touch");
}
});
边栏推荐
- AOE network critical path
- 聊聊远程办公那些事儿,参与征文领稿费拿大奖!
- yml文件配置参数定义字典和列表
- Wireshark学习笔记(二)取证分析案例详解
- CodeCraft-22 and Codeforces Round #795 (Div. 2)
- Generate XML based on annotations and reflection
- 阅读micropyton源码-添加C扩展类模块(1)
- 改变世界的开发者丨玩转“俄罗斯方块”的瑶光少年
- Aesthetic experience (episode 237) Luo Guozheng
- Abbkine柱式法ExKine Pro动物细胞/组织总蛋白提取试剂盒
猜你喜欢
随机推荐
Wireshark学习笔记(一)常用功能案例和技巧
【数据库】结构化数据、非结构化数据、半结构化数据的区别
踩坑了,BigDecimal 使用不当,造成P0事故!
Memory pool principle I (based on the whole block)
记录一个超级乌龙的智障bug,也许能帮助类似我的白吃
Abbexa CDAN1 siRNA使用说明书
afl-fuzz多线程
期货网上开户安全吗,具体怎么开户的
Faster Planner——Kinodynamic Astar详解
安装Linux系统的MySQL,在xshell中遇见的问题
PMP考生,深圳2022年6月PMP考试地点有这些
Qtablewidget / qtableview practical tips
Wireshark学习笔记(一)常用功能案例和技巧
Abbexa AML1 DNA 结合 ELISA 试剂盒说明书
套路解---马走棋盘问题
Detailed explanation of MySQL windowing function
AOE网关键路径
位运算题目
c语言学习回顾---1 基础知识回顾
Abbexa 1,3-二棕榈素 CLIA 试剂盒解决方案









