Phonegap样式-webkit-user-select:none;禁用文本字段 [英] Phonegap styles -webkit-user-select: none; disabling text field

查看:732
本文介绍了Phonegap样式-webkit-user-select:none;禁用文本字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Phonegap的新手。我有一个问题,其中在一个干净的Phonegap项目中使用的默认css将不允许输入到文本字段。我把它缩小到一行CSS:

  * {
-webkit-touch-callout:none; / *防止标注复制图像等,点击保存* /
-webkit-text-size-adjust:none; / *阻止webkit调整文本大小以适合* /
-webkit-tap-highlight-color:rgba(0,0,0,0); / *使透明链接选择,调整最后一个值不透明度0到1.0 * /
-webkit-user-select:none; / *防止复制粘贴,允许,将'none'更改为'text'* /

}

问题行是:

  -webkit-user-select:none; 

这可以在www / index.css中找到。



似乎完全禁用输入字段不是所需的效果。



问题2次前,但它被关闭,不知道为什么...我的问题是关闭,由于不是一个常见的问题。好吧,我能说的是,我想一些用户在stackoverflow不认为CSS 3,Phonegap,HTML 5和-webkit-user-select:是一种常见的情况。



但我可以看到这个问题也发布在这里,也导致Safari的问题:用户选择:none导致输入字段在Safari上无法访问虽然稍有不同。

我现在的解决方案是这样:

  -webkit-user-select: / *将'none'改为'text'* / 

优雅的解决方案来启用文本输入,但仍然保持Phonegap尝试实现的一些此副本和过去的功能。谢谢!

解决方案

尝试将其添加到您的css:

  input {
-webkit-user-select:auto!important;
}

这将覆盖您对每个元素设置的文本选择禁用通过*选择器)输入字段。


I'm pretty new to Phonegap. I have a problem where the default css used in a clean Phonegap project won't allow input into text fields. I narrowed it down to one line of CSS:

* {
            -webkit-touch-callout: none;                /* prevent callout to copy image, etc when tap to hold */
            -webkit-text-size-adjust: none;             /* prevent webkit from resizing text to fit */
            -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
            -webkit-user-select: none;                 /* prevent copy paste, to allow, change 'none' to 'text' */

    }

The problem line is:

-webkit-user-select: none; 

This can be found in www/index.css.

Seems like completely disabling the input field isn't the desired effect.

I've also posted this problem 2 times before but it was closed, not sure why... My issue was closed due to not being a common problem. Well, all I can say about that is, I guess some users at stackoverflow don't think CSS 3, Phonegap, HTML 5, and -webkit-user-select: is a common situation. I'd beg to differ.

However I can see this issue also posted here, also causing problems in Safari: User select:none causes input field to be inaccessible on Safari Although slightly different.

My current solution is this:

-webkit-user-select: text; /* change 'none' to 'text' */

Just still curious as to what is the most elegant solution to enable the text input, but still maintain some of this copy and past functionality that Phonegap is trying to achieve. Thanks!

解决方案

Try adding this to your css:

input {
    -webkit-user-select: auto !important;
}

This will override the text selection disabling that you have set on every single element (via the * selector) for input fields.

这篇关于Phonegap样式-webkit-user-select:none;禁用文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆