Determine the terminal and perform different processing methods (functions) for the corresponding terminal
$ ("#btn_download"). Click (function () { 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$ ("#lucencyBg"). Show (); if(isandroid) {//Android Terminal processing functionAlert (' is Android: ' +isandroid); }Else if(Isios) {//iOS terminal processing functionsAlert (' is iOS: ' +Isios); }Else{alert ("Other Browsers"); } });
Attached: jquery processing background picture does not fill the screen:
$ ("#_main"). Height (window.innerheight); // two options available, available on request // window.screen.height // window.innerheight //
So the CSS code does not have to write height, but to add a few words of CSS:
#_main { width: 100%; background: URL (".. /images/qrbg.png ") 0 0 no-repeat; /* need to add the following code */ background-size: 100% auto; display: flex; justify-content: center;}
JQuery to determine whether the terminal is iOS or android/jquery processing background images can not fill the screen