On an app I'm building I need to disable zooming and scrolling which I did with the viewport meta tag:
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'>
It all works fine if I try to sweep with one finger but when I use 2 fingers to pinch and one of them lifts up from the screen the scrolling gets enabled until I lift the second finger from the screen as well! Also, while keeping one finger on, if I touch with the second one and pinch, it will zoom as well...
I've tried to add preventdefault on gesturechange but it doesn't seem to work. Any ideas what am I doing wrong?
Here is some code I've already used:
document.body.addEventListener('touchmove', function(e){ e.preventDefault(); });
document.body.addEventListener('gesturechange', function(e){
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
});
try this:
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name='viewport' content='width=device-width, initial-scale="1.0", maximum-scale="1.0", user-scalable="no">
将用户可扩展性设置为否。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.