Jak wyłączyć przewijanie na iPad webapp?
Zwykle:
document.body.addEventListener('touchmove',function(event){event.preventDefault();},false);
Nie działa na mnie. Staram się, aby moja aplikacja WebApp na iPada była jak najbardziej natywna.
Każda odpowiedź jest mile widziana. 21
1 answers
Umieść ten handler bezpośrednio na elemencie document
, a nie na body
.
Odniosłem sukces z:
<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">
Następnie z jQuery:
$(document).bind('touchmove', false);
Będzie to również przydatne, jeśli chcesz obsługiwać różne orientacje:
<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)">
53
Author: Alnitak,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-10-11 23:35:53
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-10-11 23:35:53