Mobile browser Browse WebApp pop-up keyboard overlay text box solution
Recently encountered Android built-in Browse H5 page, because the text input box (input) placed near the bottom of the page, click on the text box, the input box will be pop-up phone input keyboard cover.
Find a section of the JS code directly resolved, click on the forced scrolling, it seems to solve the same problem under the Android browser browsing.
1 if (/android [4-6]/.test (Navigator.appversion)) {2 window.addeventlistener ("Resize", function () {3 if ( document.activeelement.tagname== "INPUT" | | document.activeelement.tagname== "TEXTAREA") {4 window.settimeout (function () {5 Document.activeElement.scrollIntoViewIfNeeded (); 6 },0); 7 }8 }) 9}
Add a piece of code: for some pages, because there may be a toolbar at the bottom of the page design (for example, some pages fixed a footer at the bottom), although the system does not need to scroll, but when the input method, The toolbar at the bottom is moving up to cover the input box (common in the case where the input box is exactly in the middle of the page).
You can hide the bottom toolbar by judging the screen height changes.
<script type= "Text/javascript" > document.write (' <style> #footer {Visibility:hidden} @media ( Min-height: ' + ($ (window). Height ()-ten) + ' px) {#footer {visibility:visible}}</style> '); </script>
Mobile browser Browse WebApp pop-up keyboard overlay text box solution