Media query Iphone6, iphone6 PLUS,JS judging device model

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:portrait) {
. dialog-agreement-con{
height:60%;/* iphone6 Vertical Screen */
}
}
@media only screen and (min-device-width:414px) and (max-device-width:736px) and (orientation:portrait) {
. dialog-agreement-con{
height:60%;/* iphone6 plus Vertical screen */
}
}
. dialog-agreement-con{
Overflow-y:scroll;
Margin-bottom:2rem;
}

CSS Judging horizontal screen vertical screen
@media screen and (orientation:portrait) {
/* Vertical Screen css*/
}
@media screen and (Orientation:landscape) {
/* Horizontal Screen css*/
}

JS Judge Horizontal Screen vertical screen
Determine the status of the phone screen:
Window.addeventlistener ("Onorientationchange" in Window?) "Orientationchange": "Resize", function () {
if (window.orientation = = = | | window.orientation = = 0) {
Alert (' Vertical screen 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== ' 90 ') {
$ ('. Landscape-wrap '). 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;

Media query Iphone6, iphone6 PLUS,JS judging device model

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.