css
/*iphoneX*/
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
.m-iletter-detail{top:55px;}
.m-iletter-top-title{margin:20px auto 0;}
.m-iletter-mid-user.mt9{margin-top:30px;}
.m-iletter-mid-info{margin:30px auto 0;}
.m-iletter-bottom-btn{margin:50px auto 0;}
}
/*iphoneXR*/
@media only screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio:2) {
.m-iletter-detail{top:55px;}
.m-iletter-top-title{margin:30px auto 0;}
.m-iletter-mid-user.mt9{margin-top:60px;}
.m-iletter-mid-info{margin:40px auto 0;}
.m-iletter-bottom-btn{margin:70px auto 0;}
}
js判断手机型号
var events = navigator.userAgent;
if(events.indexOf('Android')>-1 || events.indexOf('Linux')>-1 || events.indexOf('Adr')>-1){
//console.log("安卓手机");
}else if(events.indexOf('iPhone')>-1){
//根据尺寸进行判断 苹果的型号
if(screen.height == 812 && screen.width == 375){// 进行操作,改变样式
//console.log("iphoneX");
const obj = document.getElementById('sendxBtn')
$(".m-iletter-mid-user.mt9").attr("style", "margin-top:6vh;");
$(".m-iletter-mid-apply").attr("style", "margin:6vh auto 0;");
$(".m-iletter-bottom-btn").attr("style", "margin:5vh auto 0;");
$(".m-iletter-detail").attr("style", "top:50px;");
}else if(screen.height == 736 && screen.width == 414){
//console.log("iphoneXR");
$(".m-iletter-mid-user.mt9").attr("style", "margin-top:6vh;");
$(".m-iletter-detail").attr("style", "top:50px;");
}
}