【问题标题】:How to disable the pinch-zoom gesture on Windows8 laptops如何在 Windows8 笔记本电脑上禁用捏合缩放手势
【发布时间】:2015-01-06 08:12:40
【问题描述】:

我正在使用 C#、JavaScript 和 HTML5 开发 Windows 8 桌面应用程序。在 C# 级别中,我使用的是 WebView 对象。

我想在我的应用程序中禁用捏合缩放。我知道如何在 HTML 中做到这一点:

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

当我以 独立 运行 HTML 页面时,它正在工作(我将 URL 粘贴到 Internet Explorer 中)。但是当我运行整个应用程序时,它就不起作用了——捏缩放是启用的,而不是禁用的。

顺便说一句:我使用的是 Internet Explorer 10。

有什么提示吗?

【问题讨论】:

    标签: c# html internet-explorer windows-8 internet-explorer-10


    【解决方案1】:

    在 IE10(以及很快其他浏览器)中,在 HTML/CSS/JS 中防止触摸缩放缩放的最简单方法是使用 touch-action CSS 属性(在 IE10 中以供应商为前缀)。默认值为“auto”,在 IE10 中默认包括平移、双指缩放和双击缩放。您可以只使用您想要启用的触摸行为来覆盖:

    html {
        -ms-touch-action: pan-x pan-y; /* Enables only panning */
    }
    

    有关更多信息,请参阅 W3C 指针事件标准: http://www.w3.org/TR/pointerevents/#declaring-candidate-regions-for-default-touch-behaviors

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-02
      • 1970-01-01
      • 2014-02-12
      • 2023-01-19
      • 2021-12-30
      • 1970-01-01
      • 1970-01-01
      • 2014-08-09
      相关资源
      最近更新 更多