在 Windows Phone 上禁用双击缩放 [英] Disable double tap zoom on Windows Phone

查看:18
本文介绍了在 Windows Phone 上禁用双击缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 HTML 和 JavaScript 开发基于浏览器的点击游戏.我设法抑制了导致移动浏览器在 iOS 和 Android 中缩放、滚动和执行各种其他技巧的默认行为.

I've been working on a browser based clicking game using HTML and JavaScript. I have managed to suppress default behaviours causing mobile browsers to zoom, scroll and perform various other tricks in iOS and Android.

然而,对于 Windows Phone,双击仍会导致它尝试放大.在测试中,它放大然后恢复到正常大小,但这足以阻止游戏元素,它的点击速度与点击速度一样快你可以.

However with the Windows Phone a double click still causes it to try and zoom in. In testing it zooms in and then reverts back to its normal size but this is enough to block the game play element, which is clicking as fast as you can.

我在 HTML 中有以下内容:

I have the following in HTML:

<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, user-scalable=0">

我在 JavaScript 中也有以下内容:

I also have the following in JavaScript:

window.addEventListener('touchstart', function(e) {
    clickarea.trigger('click'); // this is what tracks the number of clicks / touches
    e.preventDefault();
}, false);

window.addEventListener('touchmove', function(e) {
    e.preventDefault();
}, false);

window.addEventListener('touchend', function(e) {
    e.preventDefault();
}, false);

Windows Phone 是否有任何我遗漏的其他事件或我的代码中是否有错误?

Does Windows Phone have any additional events that I'm missing or is there an error in my code?

推荐答案

我看到了一个错误

meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, user-scalable=0"

最后一个用户可扩展的值是错误的.下一个字符串应该工作:

last user-scalable value is wrong. Next string should work:

meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"

这篇关于在 Windows Phone 上禁用双击缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆