【发布时间】:2011-12-05 17:31:33
【问题描述】:
通常:
document.body.addEventListener('touchmove',function(event){event.preventDefault();},false);
不适合我。我试图让我的 iPad webapp 尽可能地原生。 任何答案表示赞赏。
【问题讨论】:
标签: javascript ipad web-applications scroll
通常:
document.body.addEventListener('touchmove',function(event){event.preventDefault();},false);
不适合我。我试图让我的 iPad webapp 尽可能地原生。 任何答案表示赞赏。
【问题讨论】:
标签: javascript ipad web-applications scroll
将该处理程序直接放在document 元素上,而不是放在body 上。
我在以下方面取得了成功:
<meta name="viewport" content="user-scalable=1.0,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
然后用 jQuery:
$(document).bind('touchmove', false);
如果您想处理不同的方向,这也很有用:
<link rel="stylesheet" type="text/css" href="css/main.css" media="all">
<link rel="stylesheet" type="text/css" href="css/landscape.css" media="all and (orientation:landscape)">
<link rel="stylesheet" type="text/css" href="css/portrait.css" media="all and (orientation:portrait)">
【讨论】:
window 对象上?