软键盘把底部div顶上去

安卓手机,软键盘把底部div顶上去解决方案:

<script>
    //点击输入数字
    window.onresize = function () {
        var h = $(window).height();
        var u = navigator.userAgent;
        if ( u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {
            if(h <= window.screen.availHeight/2){
                document.getElementById('toNav').style.position = 'relative';
            }else{
                document.getElementById('toNav').style.position = 'fixed';
            }
        }
    };
</script>

 注:底部div的ID是“toNav”

posted @ 2019-11-14 16:56  万里冰封  阅读(766)  评论(0编辑  收藏  举报