ios微信浏览器软键盘收起后,软键盘的位置没有收回去,html,body,百分百也没用

ios微信浏览器软键盘收起后,软键盘的位置没有收回去,html,body,百分百也没用,
黄色那条线就是body,红色那条件是html
怎么把这个位置收回去?
这个问题导致fixed的按钮点击失效

图片描述

阅读 3.5k
3 个回答

找不到链接了,标注一下原创吧?

//微信版本bug解决方法 CSDN博主「yanhailun」的原创文章
function resolveIosBug(e){
    setTimeout(function(){
        // alert(1);
        if(document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA'){
            return
        }
        let result = 'pc';
        if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { //判断iPhone|iPad|iPod|iOS
            result = 'ios'
        }else if(/(Android)/i.test(navigator.userAgent)) {  //判断Android
            result = 'android'
        }
        if(result = 'ios'){
            document.activeElement.scrollIntoViewIfNeeded(true);
        }
    },10)
}

软键盘收起的时候给body加个样式visibility: visible;触发下重绘试试

推荐问题