First, the previous paragraph to determine the JS code for Android and iOS
Function Navigator () {varU =navigator.useragent; varIsandroid = U.indexof ('Android') >-1|| U.indexof ('ADR') >-1;//Android Terminal varIsios =!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/);//iOS terminal if(isandroid) {// Android }; if(Isios) {//iOS }; };navigator ();
iOS FAQs:
1. Search page Search button is not displayed, add form to solve.
<form action=""> <input type="search" name= "id="" value="" /> </form>
2. Remove input shadows and black edges, and type= "search" forks.
css://removes shadows and black input:-webkit-appearance:none; (global input removes shadows and black bottoms, which can be done for an input.) )//Remove small fork input[type= "search"]::-webkit-search-cancel-button{ -webkit-appearance:none;}
iOS: Listening keyboard bounce and pick up:
$ (document). On ("Focusin", function () { ///Keyboard Popup}) $ (document). On ("Focusout", function () { //keyboard closed})
iOS: When the head input box is focused, want to bounce the bottom fixed positioning elements, placed above the keyboard, such as footer, or upload a picture of the button or something, but found not up, it's OK I have a solution.
Function Navigator () {var u = navigator.useragent; var isandroid = u.indexof (' Android ') >-1 | | U.indexof (' Adr ') >-1; Android terminal var Isios =!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/); iOS terminal if (isandroid) {}; if (Isios) {$ (document). On ("Focusin", function () {////keyboard bounces to the bottom of the scroll bar, $ (window). ScrollTop ($ ("body"). Height ()); Set Timer setTimeout (function () {//Get document height var clien Theight= Document.body.clientHeight; Gets the scroll height-that is, the keyboard height var scrolltop = document.body.scrollTop; Let you want the bottom of the bottom element: keyboard height. $ (". Bottom"). CSS ("bottom", scrolltop+ "px"); Finally, set a timer to get the scroll bar back to the top. SetTimeout (function () { $ (window). scrolltop (0); },300); },300); }); $ (document). On (' Focusout ', function () {//Soft keyboard closed event handling//Let the bottom element return to the bottom. $ (". Bottom"). CSS ("bottom", "0"); }); }; };Navigator();
Android:
1. Keyboard Pick Up event:
functionNavigator() {var u = navigator.useragent; var isandroid = u.indexof (' Android ') >-1 | | U.indexof (' Adr ') >-1; Android terminal var Isios =!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/); iOS terminal if (isandroid) {var wheight = $ (window). Innerheight (); Gets the initial visual window height of $ (window). Resize (function () {//Monitor window size Change event var h h = $ (window). Innerheight (); Current visual window height var viewtop = $ (window). scrolltop (); Visual window height top distance from top of page if (Wheight > HH) {//can be used as a virtual keyboard popup event }else{//Can be used as a virtual keyboard shutdown event }; Wheight = hh; }); }; if (Isios) {};};Navigator();
Mobile-compatible processing