Compatible with different versions of iphone and screen

Source: Internet
Author: User

/* Compatibility issue */@media screen and (device-width:320px) and (device-height:480px) and (-webkit-device-pixel-ratio:2) {. dialog  -agreement-con{height:45%;   /* iphone4*/}} @media screen and (device-width:320px) and (device-height:568px) and (-webkit-device-pixel-ratio:2) {  . dialog-agreement-con{height:55%; /* iphone5*/}} @media only screen and (min-device-width:375px) and (MAX-DEVICE-WIDTH:667PX) and (Orientation:portrai  T) {. dialog-agreement-con{height:60%; /* iphone6 Vertical screen */}} @media only screens and (min-device-width:414px) and (max-device-width:736px) and (Orientation:portra  It) {. dialog-agreement-con{height:60%; /* iphone6 plus vertical screen */}}.dialog-agreement-con{overflow-y:scroll; margin-bottom:2rem;} CSS Judge horizontal screen vertical @media screen and (orientation:portrait) {/* Portrait css*/} @media screen and (Orientation:landscape) {/* Landscape CSS*/}JS judgment Horizontal screen Vertical screen//Judge phone screen status: Window.addeventlistener ("Onorientationchange" in window? "Orientationchange": "Resize", function () {if (Window.orientation = = 180 | | Window.orientation = = 0) {alert (' Vertical state!  ‘); } if (window.orientation = = = | | window.orientation = = -90) {alert (' Horizontal screen state!  ‘); }}, False);//mobile browser generally support window.orientation This parameter, through this parameter can determine whether the phone is in a horizontal screen or vertical screen state. Horizontal screen monitoring var updateorientation = function () {if (window.orientation== ' -90 ' | | window.orientation== ') {$ ('. LANDSCAPE-WR    AP '). Removeclass (' hide '); Console.log (' For a better experience, please put your phone/tablet back on!  ‘);    }else{$ ('. Landscape-wrap '). addclass (' hide ');  Console.log (' Vertical screen status '); }};window.onorientationchange = updateorientation;

  

Compatible with different versions of iphone and 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.