【问题标题】:How to disable IOS double-tap zoom in mobile browser for a Angular webapp? (I tried everything)如何在 Angular webapp 的移动浏览器中禁用 IOS 双击缩放? (我什么都试过了)
【发布时间】:2021-08-02 00:16:53
【问题描述】:

我试过了:

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


<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

body {
  touch-action: manipulation !important;
}

没有任何效果,我仍然可以在 iOS 上双击 safari 和 chrome。

有什么想法吗?谢谢。

【问题讨论】:

    标签: html css ios angular google-chrome


    【解决方案1】:

    CSS 全局禁用双击缩放:

    * {
      touch-action: manipulation;
    }
    

    编辑:

    我在带有 IOS v14.4.2 的 iPhone 7 Plus 上对此进行了测试,它适用于我。

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>No double tap</title>
      <style>
        .no-double-tap {
          touch-action: manipulation;
        }
      </style>
    </head>
    <body>
      <h2>no double tap</h2>
      <img class="no-double-tap" src="https://picsum.photos/id/1/200/300">
      <h2>double tap</h2>
      <img src="https://picsum.photos/id/2/200/300">
    </body>
    </html>
    

    【讨论】:

    • 我添加了一个适用于我的设备的示例。
    猜你喜欢
    • 2020-11-11
    • 2012-05-23
    • 2018-02-20
    • 2014-06-12
    • 1970-01-01
    • 2014-04-07
    • 1970-01-01
    相关资源
    最近更新 更多