Is there a non-hacky way to prevent pinch zoom on iOS 11.3 Safari?

后端 未结 3 1469
粉色の甜心
粉色の甜心 2020-12-30 03:18

I really want to disable pinch to zoom on my webpages (iframes) and use finger pinching events for another custom interaction. So while Apple in their documentation

相关标签:
3条回答
  • 2020-12-30 03:38

    While there isn't a non-hacky way to prevent pinchzoom, there is a hack that works on iOS 11.3 Safari still. At least for now. See inobounce that handles both rubber band behavior and pinchzoom in one fell sweep.

    0 讨论(0)
  • 2020-12-30 03:41

    You can use touch-action: none on the html, body selector: https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action#none

    https://github.com/msand/InfiniDraw/commit/b96aac5f8313f56da7be6f9e9f24648ab02fc444

    0 讨论(0)
  • 2020-12-30 03:47

    From How do you disable viewport zooming on Mobile Safari?

    Try adding the following to your head-tag:

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

    additionally

    <meta name="HandheldFriendly" content="true">
    

    Finally, either as a style-attribute or in your css file, add the following text for webkit-based Browsers:

    html {
        -webkit-text-size-adjust: none
    }
    
    0 讨论(0)
提交回复
热议问题