关于手机端input获取焦点呼起键盘背景图片挤压解决方案

1、解决图片挤压问题

可以将背景图片height: 100%改为min-height:100%即可

2、解决android下键盘不遮挡input输入框

// 处理android 下键盘遮挡input
            let ua = window.navigator.userAgent;
            if(ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1){
                var winHeight = $(window).height(); //获取当前页面高度
                $(window).resize(function() {
                    var thisHeight = $(this).height();
                    if (winHeight - thisHeight > 50) {
                        $('body').css('height', winHeight + 'px');
                        $('.lml-phone-login').css({'bottom': '-50px'})
                    } else {
                        $('body').css('height', '100%');
                        $('.lml-phone-login').css({'bottom': '0px'})
                    }
                });
            }

猜你喜欢

转载自blog.csdn.net/u010881899/article/details/80898665