离开输入表单后,JQuery-mobile,Phonegap,iOS,固定标题跳转

时间:2013-09-09 18:38:03

标签: ios jquery-mobile cordova

我在iOS上使用Phonegap和JQuery-mobile,Phonegap。我在离开表单输入时遇到了跳转到中间的问题。

我已经在固定的页眉和页脚上设置了数据隐藏 - 焦点=“真”。这个问题让我很难过。

3 个答案:

答案 0 :(得分:2)

如果我们只有一个标题栏,那么我们只能遵循主标题栏的代码。

    $(document).on('focus', 'select, input, textarea', function () {
        $('#main-headerbar').css({'position': 'absolute', 'top': '0px' });
    });
    $(document).on('blur', 'select, input, textarea', function () {
        $('#main-headerbar').css({ 'position': 'fixed' });
    });

如果我们有两个标题栏,则第二个标题栏将显示在主标题栏下方(如果主标题栏的高度为'47px',则为第二个标题栏设置顶部样式,顶部:47px)。

$(document).on('focus', 'select, input, textarea', function () {
    $('#main-headerbar').css({'position': 'absolute', 'top': '0px' });
    $('#Second-headerbar').css({ 'position': 'absolute', 'top' : '0px' });
});
$(document).on('blur', 'select, input, textarea', function () {
    $('#main-headerbar').css({ 'position': 'fixed' });
    $('#Second-headerbar').css({ 'position': 'fixed', 'top': '47px' });
});

或关注iOS fix for position fixed elements on input

答案 1 :(得分:0)

我有类似的问题,我使用的是1.0.1,主要问题是标题跳转出现在旧的2.3版本的android甚至在谷歌Nexus手机中。我搜索互联网的次数超过了一些R& D我意识到这基本上是css的错误以下我已经做了解决它

  1. 为每个页面提供“.header”标题类
  2. 使用以下代码创建css类
  3. .header{ border: 0px; position: fixed; width: 100%; top: 0px; left: 0px; z-index: 21; }
  4. 此外,如果您在更改页面后遇到标题跳转的任何问题,请添加此代码 $.mobile.silentScroll(0);

    中的$("#yournextpageid").live("pageshow", function() { $.mobile.silentScroll(0); }

    Jquery data-position="fixed"的作用是动态地将顶部位置添加到其标题中,并且它具有开销并且在某些设备中证明非常粘。此外,它在打开键盘时跳入某些设备。添加上面的CSS将解决您的问题。

答案 2 :(得分:-1)

在Config.xml中

将该行更改为false它将解决您的问题..