h5开发安卓软键盘遮挡解决方案

Posted 高丰鸣

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了h5开发安卓软键盘遮挡解决方案相关的知识,希望对你有一定的参考价值。

//处理input focus时被键盘遮挡问题
    inputFocus:function(){
         if(/android [4-6]/.test(navigator.appVersion)) {
                 window.addEventListener("resize", function() {
                         if(document.activeElement.tagName=="INPUT" || document.activeElement.tagName=="TEXTAREA") {
                                 window.setTimeout(function() {
                                     document.activeElement.scrollIntoViewIfNeeded();
                            },0);
                        }
                   })
             }
    },

 

以上是关于h5开发安卓软键盘遮挡解决方案的主要内容,如果未能解决你的问题,请参考以下文章

安卓手机底部输入框被软键盘遮挡的坑

部分安卓手机上出现切换界面时软键盘无法收回的情况,请问该如何解决?

安卓弹出软键盘怎么把一部分布局顶上去

H5防止安卓手机软键盘弹出挤压页面导致变形的方法

Android实战开发篇 Android软键盘遮挡的解决方案

H5页面软键盘常见问题