安卓输入框调起键盘后输入框自动上浮

if (document.activeElement && /Android [4-6]/.test(navigator.appVersion)) {
window.addEventListener('resize', function () {
var tagName = document.activeElement.tagName.toUpperCase();
if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
window.setTimeout(function () {
document.activeElement.scrollIntoViewIfNeeded();
}, 100)
}
});
}

原文地址:https://www.cnblogs.com/daiwenru/p/7649072.html