解决移动端键盘弹起 导致input布局出现问题的解决方法

 var 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');
                } else {
                    $('body').css('height', '100%');
                }
            });
        }

猜你喜欢

转载自blog.csdn.net/qq_41422208/article/details/83038351