Html 如何在移动设备的网站上启用双指缩放?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12392761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to enable pinch zoom on website for mobile devices?
提问by hjuster
I am trying to enable pinch zoom on my website. I've tried to enable zooming by setting meta viewport like this but without any success.
我正在尝试在我的网站上启用双指缩放。我试图通过像这样设置元视口来启用缩放,但没有任何成功。
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2.0, minimum-scale=1, user-scalable=yes"/>
Any ideas why my siteis still not zoomable on ipads and iphones?
有什么想法为什么我的网站在 ipad 和 iphone 上仍然无法缩放?
回答by Ilan Kleiman
This may be a bit late seeing that it has been answered almost a year ago... Although I tried your meta tags on my HTML page of my IOS app. The tags didnt really let me zoom out, and barely let me zoom in, and when I would zoom, it would revert back to its original size.
看到它几乎在一年前就得到了回答,这可能有点晚了......尽管我在我的 IOS 应用程序的 HTML 页面上尝试了您的元标记。标签并没有真正让我缩小,也几乎没有让我放大,当我放大时,它会恢复到原来的大小。
Now I was able to zoom out all the way, and zoom in a "a lot" and it would hold the zooms with these meta tags:
现在我能够一直缩小,并放大“很多”,它会用这些元标记保持缩放:
<meta name="viewport" content="width=device-width, initial-scale=.5, maximum-scale=12.0, minimum-scale=.25, user-scalable=yes"/>
回答by Jacob
You can try the new hammer.js
which can simulate multiple touches.
http://eightmedia.github.io/hammer.js/
您可以尝试hammer.js
可以模拟多次触摸的新功能。
http://eightmedia.github.io/hammer.js/