IPhone keyboard pushes page up on phone latch

I am developing an iOS application in phonegap / cordova 3.3.0 with jQuery mobile 1.4.2
I developed a page with several text fields for input, but when the open iPhones keyboard opens, it pushes the page up in iphone 4, in iphone 5 I also encounter that same problem, but the page comes to its original state after closing the keyboard, but in iphone 4 the page stacks at the top in the pressed position. Check out the screenshots below. enter image description here
this is the screen
this is when the keyboard is open enter image description here


after closing the keyboard is closed enter image description here
please help ...

+1
source share
4 answers

:

document.body.scrollTop = 0;

.

:

+1

, , , , :

  window.addEventListener('native.keyboardhide', function(){
                            window.scrollTo(0,0);
                        });

.

+1

:

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

phonegap.

0

, . , iphone .

  function fixKeyboardOffset(){
    var iOSOffset = 0;
    switch ($(window).height()){
      case 716 : iOSOffset = 340; break;
      case 647 : iOSOffset = 285; break; 
      case 548 : iOSOffset = 190; break;  
      case 460 : iOSOffset = 110; break;  
    }
    if (device.platform == 'iOS'){
        $('#comment-field').on('focus', function(e) {
          $('html, body').animate({
              scrollTop: $("#content_comment_container").offset().top - iOSOffset
          }, 0);
        });
    }
  }
0

All Articles