Cordova/Phonegap 3.1 keyboard (still) overlays focused form fields - iOS 7

前端 未结 5 1847
不知归路
不知归路 2020-12-28 22:56

Hi guys I just upgraded from cordova 3.0 to 3.1 and I\'m still experiencing a very disturbing issue (which still exists when playing with KeyboardShrinksView preference).

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-28 23:11

    Finally fixed the problem with the help of the following plugin: jQuery scrollTo plugin

    Whenever i'm focusing on an element i'm triggering a focus event which does the following calculations and updates the scroll position:

    updateScroll: function(e){
        var el = $(e.currentTarget);
        var offset = -$(".scrollerWrap").height() + $(el).height();
        $(".scrollerWrap").scrollTo(el,{offset: offset});
    }
    

    Sticks the bottom of the input/textarea to the top of the keyboard. Works like a charm, even if the solution needs to go through that bit of JavaScript.

提交回复
热议问题