OGeek|极客世界-中国程序员成长平台

标题: jquery - Phonegap iOS iScroll 5 View 在虚拟键盘上向上移动 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 17:59
标题: jquery - Phonegap iOS iScroll 5 View 在虚拟键盘上向上移动

我正在使用 Phonegap、jQuery 和 iScroll 5 为 iOS 构建 native 应用程序。 iScroll 完美地工作,除了当我专注于页脚中的输入字段时。虚拟键盘出现并将整个 View 向上推。标题不在 View 中,我无法滚动到页面顶部。当输入字段失去焦点或模糊时,一切都会恢复正常。我读过 iScroll 没有检测到屏幕大小的变化,但我不知道如何修复它。我试过 window.scrollTo(0, 0) 和 scrollTop() 都没有运气。谢谢!



Best Answer-推荐答案


我为此苦苦挣扎了好几个星期。

试试

body{
    overflow: hidden; 
    position: fixed;
    top:0;
    min-height: 480px; /* Window height for iPhone 5*/
 }

在xml中:

<preference name="HideKeyboardFormAccessoryBar" value="true" />

我更改了 CDVViewController.m

来自

CGFloat actualKeyboardHeight = (keyboardFrame.size.height - accessoryHeight);
newFrame.size.height -= actualKeyboardHeight;

newFrame.size.height -= 0;

现在这对我有用,只要我在一页上没有多个输入字段,我实际上需要一些滚动。

关于jquery - Phonegap iOS iScroll 5 View 在虚拟键盘上向上移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21010323/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4