JQuery to determine whether the terminal is iOS or android/jquery processing background images can not fill the screen

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.