HTML5 虛擬鍵盤出現擋住輸入框可以用代碼
發布時間:2018/1/3 10:33:08 來源: 縱橫數據
1 2 3 4 5 6 7 | //防止鍵盤把當前輸入框給擋住$$('input[type="text"],textarea').on('click', function () { var target = this; setTimeout(function(){ target.scrollIntoViewIfNeeded(); },100);}); |
部分安卓機型適用。
1 2 3 4 5 6 7 8 9 | if(/Android [4-6]/.test(navigator.appVersion)) { window.addEventListener("resize", function() { if(document.activeElement.tagName=="INPUT" || document.activeElement.tagName=="TEXTAREA") { window.setTimeout(function() {document.activeElement.scrollIntoViewIfNeeded(); },0); } })} |
本文來源:
//66moju.cn/article/1923.html
[復制鏈接]
鏈接已復制
上一篇:沒有了
下一篇:沒有了

