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);
}
})
}
說明:
Element.scrollIntoViewIfNeeded()方法用來將不在瀏覽器窗口的可見區域內的元素滾動到瀏覽器窗口的可見區域