keyboard hide input (position:fixed; bottom:0;) with phonegap on android

我的未来我决定 提交于 2019-12-06 02:18:21

Try something like this:

Add these piece of code in $(document).ready(function() {}); function in your html page where soft keyboard is appearing.

 var initialScreenSize = window.innerHeight;
 window.addEventListener("resize", function() {
  if(window.innerHeight < initialScreenSize){
     $("#footer").hide();
     document.body.style.position = "fixed";
  }
  else{
     document.body.style.position = "";
     $("#footer").show();                                      
  }
 });

This will might help you.

karenms

You can detect focused textarea or input then wait a while until keyboard is shown and finally scroll the page to reach focused input. Hope this help you, cheers.

var container = $('body'),
        scrollTo = $('#textarea');

    setTimeout((function() {
        container.animate({
        scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop()
        });
    }), 500);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!