处理安卓手机输入法遮挡输入框问题

 // 处理安卓手机输入法遮挡输入框问题
    if ((/Android/gi).test(navigator.userAgent)) {
        window.addEventListener('resize', function () {
            if (document.activeElement.tagName == 'INPUT' || 
                document.activeElement.tagName == 'TEXTAREA') {
                window.setTimeout(function () {
                    document.activeElement.scrollIntoViewIfNeeded();
                }, 0);
            }
        });
    } 

猜你喜欢

转载自blog.csdn.net/zhan_lijian/article/details/83790758