安卓手機輸入框被軟鍵盤遮住的問題,如何在點擊輸入框的時候類似與IOS那種,輸入框直接在軟件盤的上面,而不會被遮住
在代碼中加入如下代碼:
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); } }) }