【问题标题】:Remove text selection from PhoneGap iOS app从 PhoneGap iOS 应用程序中删除文本选择
【发布时间】:2013-02-26 19:54:00
【问题描述】:

我正在尝试找到一种方法来限制整个 PhoneGap 应用程序中的文本选择。有人知道这样做的方法吗?

【问题讨论】:

标签: ios cordova


【解决方案1】:
html {
-webkit-user-select: none;
}

你的 css 代码中的这个小成分会变魔术!

【讨论】:

  • 我将此响应与@Suhas -webkit-touch-callout 一起使用,效果很好...为两者投票...
【解决方案2】:

这对你有用:-

<style type="text/css">
   *:not(input):not(textarea) {
   -webkit-user-select: none; /* disable selection/Copy of UIWebView */
   -webkit-touch-callout: none; /* disable the IOS popup when long-press on a link */
  }     
</style>

使用java脚本:-

 document.documentElement.style.webkitTouchCallout = "none";
 document.documentElement.style.webkitUserSelect = "none";

【讨论】:

    【解决方案3】:

    在 iOS 9 中,有一个错误导致 -webkit-user-select: none; 不起作用。有一个插件可以解决这个问题

    https://github.com/EddyVerbruggen/cordova-plugin-ios-longpress-fix

    感谢 Frederik Wessberg https://stackoverflow.com/a/32737049/741850

    【讨论】:

    • 感谢这解决了它。既然插件没有做那么多,你可能想考虑复制实现。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-08
    • 1970-01-01
    • 2014-12-22
    • 2013-09-18
    • 2014-03-27
    • 2018-03-16
    • 1970-01-01
    相关资源
    最近更新 更多