简体   繁体   English

输入在Phonegap应用中不起作用

[英]input not working in phonegap app

I'm creating a Cordova PhoneGap app and have trouble with the input fields. 我正在创建一个Cordova PhoneGap应用程序,输入字段有问题。

I'm using iScroll for scroll and refresh. 我正在使用iScroll进行滚动和刷新。

Suddenly my input fields aren't responding. 突然我的输入字段没有响应。 So users can't even login when they start the app. 因此,用户甚至无法在启动应用程序时登录。

I use standard fields and i can't give the input fields focus. 我使用标准字段,但我无法为输入字段指定焦点。 Not even with a wrapper where I set "[input].focus()". 甚至在我设置“ [input] .focus()”的包装器中也没有。

The html code is html代码是

<input class="newinput" onclick="this.focus();" type="email" id="email" name="email" value="" autocorrect="off" autocapitalize="off" required="" placeholder="Enter E-mail address">

The CSS is CSS是

.newinput {
width: 100%;
border: none;
padding: 0;
margin: 3px 0px 1px 0px;
background: white;
font-size: 16px;
color: #43ACDB;
z-index: 40;
}

Other style is (found with chrome developer console) 其他样式是(可通过chrome开发者控制台找到)

-webkit-writing-mode: horizontal-tb;
font: -webkit-small-control;
letter-spacing: normal;
word-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
display: inline-block;
text-align: start;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-appearance: textfield;
-webkit-rtl-ordering: logical;
-webkit-user-select: text; // tried without this line too
cursor: auto;

The input fields have worked before but suddenly not a single one can get focus. 输入字段以前曾经起作用过,但突然之间没有一个可以得到关注。 Unfortunately, I don't when they stopped working cause I have auto-login so I don't use the input fields for most of the apps functionality. 不幸的是,由于它们具有自动登录功能,因此我无法在它们停止工作时使用,因此我不使用大多数应用程序功能的输入字段。

I have checked all js and css code and haven't got a single line starting with "-webkit-user" (except for debugging) 我已经检查了所有js和css代码,并且没有以“ -webkit-user”开头的一行(调试除外)

The code works fine if i just go to the index.html on a browser on my mac but android simulator and browser on iphone, android and ipad has this error 如果我只是在Mac上的浏览器上转到index.html,但代码正常,但android模拟器以及iPhone,Android和iPad上的浏览器出现此错误

What else can I do to get the input working again? 我还能做些什么才能使输入再次起作用?

Ok found the answer. 确定找到了答案。 Strangely enough its a iScroll bug that has been around since 2010. 自2010年以来出现的iScroll错误就足够奇怪了。

Use the following settings: useTransform and onBeforeScrollStart. 使用以下设置:useTransform和onBeforeScrollStart。 Eg 例如

myScroll = new iScroll(
    'wrapper', /** Change this to match your container ID **/
    {
        useTransform: true,
        onBeforeScrollStart: function (e) {
            var target = e.target;
            while (target.nodeType != 1) {
                target = target.parentNode;
            }
            if (target.tagName != 'SELECT' && target.tagName != 'INPUT'
                && target.tagName != 'TEXTAREA'
            ) {
                e.preventDefault();
            }
        }
        /** Add Any Additional Settings here **/
     }
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM