【发布时间】:2013-02-26 19:54:00
【问题描述】:
我正在尝试找到一种方法来限制整个 PhoneGap 应用程序中的文本选择。有人知道这样做的方法吗?
【问题讨论】:
-
似乎与以下内容重复:stackoverflow.com/questions/5995210/…
我正在尝试找到一种方法来限制整个 PhoneGap 应用程序中的文本选择。有人知道这样做的方法吗?
【问题讨论】:
html {
-webkit-user-select: none;
}
你的 css 代码中的这个小成分会变魔术!
【讨论】:
这对你有用:-
<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";
【讨论】:
在 iOS 9 中,有一个错误导致 -webkit-user-select: none; 不起作用。有一个插件可以解决这个问题
https://github.com/EddyVerbruggen/cordova-plugin-ios-longpress-fix
感谢 Frederik Wessberg https://stackoverflow.com/a/32737049/741850
【讨论】: