html5移动端:手机触控gesturestart(js)

本文介绍了HTML5中与触控相关的touch和gesture事件,详细解析了touchstart、touchend、touchmove和touchcancel事件,以及如何获取和理解触点信息,包括touches、targetTouches和changedTouches列表。还提到了在多点触摸设备上,如何利用这些事件和信息来实现更复杂的交互,例如JavaScript版的超级玛丽游戏。最后指出,通过调用touchmove事件对象的preventDefault方法可以防止页面在手指移动时滚动。
摘要由CSDN通过智能技术生成
<!doctype html>
<html>
  <head>
<title>Mobile Cookbook</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
html, body {
padding: none;
margin: none;
}
</style>
  <!-- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>-->
  </head>
  <body>
    <div id="a">手机旋转  jquery
    </div>
<script>
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
alert(navigator.userAgent.match(/iPhone/i));
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
document.addEventListener("gesturestart", gestureStart, false);
}
function gestureStart() {
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值