gpt4 book ai didi

javascript - 输入在 phonegap 应用程序中不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 13:27:39 24 4
gpt4 key购买 nike

我正在创建一个 Cordova PhoneGap 应用程序,但在输入字段方面遇到了问题。

我正在使用 iScroll 进行滚动和刷新。

我的输入字段突然没有响应。因此,用户在启动应用程序时甚至无法登录。

我使用标准字段,但无法为输入字段提供焦点。甚至没有我设置“[input].focus()”的包装器。

html代码是

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

CSS 是

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

其他风格是(用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;

输入字段之前可以正常工作,但突然间没有一个可以获得焦点。不幸的是,当他们停止工作时我没有这样做,因为我有自动登录功能,所以我不使用大多数应用程序功能的输入字段。

我检查了所有的 js 和 css 代码,没有一行以“-webkit-user”开头(调试除外)

如果我只是在我的 mac 上的浏览​​器上访问 index.html,代码工作正常,但在 iphone、android 和 ipad 上的 android 模拟器和浏览器有这个错误

我还能做些什么来让输入再次工作?

最佳答案

好的找到答案了。奇怪的是,它是一个自 2010 年以来就存在的 iScroll 错误。

使用以下设置:useTransform 和 onBeforeScrollStart。例如。

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 **/
}
);

关于javascript - 输入在 phonegap 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23603442/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com