HTML5 虛擬鍵盤出現(xiàn)擋住輸入框可以用代碼
- 來源:縱橫數(shù)據(jù)
- 作者:中橫科技
- 時間:2018/1/3 10:33:08
- 類別:新聞資訊
1 2 3 4 5 6 7 | //防止鍵盤把當(dāng)前輸入框給擋住$$('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); } })} |




使用微信掃一掃
掃一掃關(guān)注官方微信 

