在 Android PhoneGap 应用程序中使用 JQTouch 打字时屏幕滚动?
我使用 JQtouch、Jquery 和 PhoneGap 制作了一个应用程序。当您在表单字段中键入内容时,每次输入字符时整个页面都会向上或向下滚动。我到处寻找解决方案,但找不到。 这里也有类似的问题:https://github.com/jquery/jquery-mobile/issues/638 但他的解决方案没有解决我的问题。
有谁知道为什么页面会随着文本框中添加的每个字符而上下滚动?由于页面太小,上下滚动速度很快,非常烦人。
I have made an app using JQtouch, Jquery, and PhoneGap. When you type in a form's field, the entire page scrolls up or down each time you enter a character. I have searched everywhere for solutions but cannot find one.
There was a similar problem here: https://github.com/jquery/jquery-mobile/issues/638
but his solution did not solve my issue.
Does anyone have an idea why the page would scroll up and down with each added character in a textbox? Because the page is so small, it scrolls up and down quickly making it very annoying.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将以下 CSS 放入文件中所有其他 CSS 样式之后:
这应该可以解决您的问题(至少对我来说是这样)。
Put the following CSS in your file after all other CSS styles:
This should solve your problem (at least it did for me).
在名为 onload 的初始化函数中尝试此操作:
function PreventBehavior(e)
{
e.preventDefault();
};
document.addEventListener("touchmove", PreventBehavior, false);
更多讨论请访问 http://groups.google.com/group/phonegap/browse_thread /线程/739525b7531b6d29/
Try this in an init function called onload :
function preventBehavior(e)
{
e.preventDefault();
};
document.addEventListener("touchmove", preventBehavior, false);
More discussion at http://groups.google.com/group/phonegap/browse_thread/thread/739525b7531b6d29/
我在 Android 2.2 上遇到了同样的问题。我将以下属性放入 CSS 中,然后发现问题已解决。是什么因素造成了差异?我不知道,但它对我有用:
试试这个,它可能对你也有用。
I faced the same issue on Android 2.2. I put the following properties in my CSS and then found that the issue had been resolved. What thing made the difference; I don't know, but it is working for me:
Try this, it may work for you also.
我正在使用新的测试版(jqtouch-1.0-b4-rc),因此我无法让这些技巧在 Android 2.2 或 2.3 上运行。最后我通过在 CSS 的底部包含以下内容来修复它:
I'm using the new beta version (jqtouch-1.0-b4-rc), and with that I couldn't get these tricks to work on either Android 2.2 or 2.3. In the end I fixed it by including in the following at the base of my CSS: