html 键盘遮挡问题

2018-08-02  本文已影响0人  木利
window.onresize = function () {
 var ua = navigator.userAgent;
 var isAndroid = /android/i.test(ua); //android终端
 if(isAndroid) {
   if (document.activeElement.tagName == "INPUT" || document.activeElement.tagName == "TEXTAREA") {
       window.setTimeout(function() {
           document.activeElement.scrollIntoViewIfNeeded();
       },0);
   }
 }   
}
上一篇 下一篇

猜你喜欢

热点阅读