iPhone Detect Zoom - Help!

与世无争的帅哥 提交于 2019-12-11 12:07:56

问题


This works in all my test browsers:

<body onresize="handleResize()">

 

// Aint perfect, but works well enough!
function handleResize()
{
    // Document.ready sets initialWidth = window.innerWidth;
    var zoomAmount = Math.round((initialWidth / window.innerWidth) * 100);
    $('#db').html(zoomAmount);
}

On iPhone when I use two fingers to zoom in and out, this number is not updated.

How can I trigger an event when the iPhone user zooms?


回答1:


You can't. When you pinch to zoom on the iPhone web kit, you're not actually resizing the view of the web page in the same sense as when you resize a browser window -- notice that the content doesn't reflow. All the iPhone is doing is blowing up a certain section of the complete web content.



来源:https://stackoverflow.com/questions/5221446/iphone-detect-zoom-help

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!