iphone手机不同版本兼容、横竖屏

/* 兼容问题*/

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

CSS判断横屏竖屏

@media screen and (orientation: portrait) {
/*竖屏 css*/
}
@media screen and (orientation: landscape) {
/*横屏 css*/
}

JS判断横屏竖屏

//判断手机横竖屏状态:
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
  if (window.orientation === 180 || window.orientation === 0) {
    alert(‘竖屏状态!‘);
  }
  if (window.orientation === 90 || window.orientation === -90 ){
    alert(‘横屏状态!‘);
  }
}, false);

//移动端的浏览器一般都支持window.orientation这个参数,通过这个参数可以判断出手机是处在横屏还是竖屏状态。

// 横屏监听
var updateOrientation = function(){
  if(window.orientation==‘-90‘ || window.orientation==‘90‘){
    $(‘.landscape-wrap‘).removeClass(‘hide‘);
    console.log(‘为了更好的体验,请将手机/平板竖过来!‘);
  }else{
    $(‘.landscape-wrap‘).addClass(‘hide‘);
    console.log(‘竖屏状态‘);
  }
};
window.onorientationchange = updateOrientation;

  

时间: 2024-08-24 03:47:10

iphone手机不同版本兼容、横竖屏的相关文章

[Flex] flex手机项目如何限制横竖屏?只允许横屏?

flex手机项目如何限制横竖屏?只允许横屏?   有人知道吗?求教.. 工程中 xxx-app.xml 找到</aspectRatio> 去掉注释 修改为<aspectRatio>landscape</aspectRatio> 另外要把<autoOrients>true</autoOrients> 改成false,就不会自动旋转了 亲测可用

有手机输入键盘时切换横竖屏高度变化的问题

function resetIosScreen() { if ( window.orientation == 90 || window.orientation == -90 ) { userHeight = window.screen.width; } else { userHeight = window.screen.height; } $(".before").height(userHeight - 70); $(".prompt").height(userHe

Iphone 手机系统版本判断

double version = [[UIDevice currentDevice].systemVersion doubleValue];//判定系统版本.

判断手机横竖屏

//判断手机横竖屏状态:window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() { if (window.orientation === 180 || window.orientation === 0) { //竖屏 } if (window.orientation === 90 || window.o

New UI-获取手机屏幕尺寸与分辨率,屏幕适配,横竖屏问题

New UI-获取手机屏幕尺寸与常用分辨率,屏幕适配,横竖屏问题 --转载请注明出处:coder-pig,欢迎转载,请勿用于商业用途! 小猪Android开发交流群已建立,欢迎大家加入,无论是新手,菜鸟,大神都可以,小猪一个人的 力量毕竟是有限的,写出来的东西肯定会有很多纰漏不足,欢迎大家指出,集思广益,让小猪的博文 更加的详尽,帮到更多的人,O(∩_∩)O谢谢! 小猪Android开发交流群:小猪Android开发交流群群号:421858269 新Android UI实例大全目录:http:/

检测手机横竖屏切换

我们做移动端项目的时候,为了更好的完善用户体会,经常会需要处理好手机横竖屏时候的效果,下面看一下通过代码如何判断手机是否是横竖屏,两种方式: 一.第一种方式: <style type="text/css">body,html { margin: 0; height: 100%; position: relative; overflow: hidden;} #box { width: 100%; height: 100%; font-size: 20px; position:

Javascript 判断手机横竖屏状态

判断手机横竖屏状态: <script type=”text/javascript”> function hengshuping(){ if(window.orientation==180||window.orientation==0){ alert(“竖屏状态!”) } if(window.orientation==90||window.orientation==-90){ alert(“横屏状态!”) } } window.addEventListener(“onorientationcha

css3完美解决手机横竖屏判断,让用户看邀请函更爽

html: <div id="cover1"></div> <p id="cover1w">亲,请竖屏观看本屏内容,谢谢^_^</p> css: /* 判断手机横竖屏  */ @media screen and (orientation:portrait) { /*  css[竖向定义样式]  */ #cover1{display: none;width: 100%;height: 100%;background-co

iphone手机怎么录屏 两种方法任你挑选

iphone手机怎么录屏呢?苹果手机拥有独特的Airlay镜像投屏,AirPlay的工作原理是当iPhone或IPAD与支持AirPlay技术的硬件,比如Apple TV等设备处在同一个wife的情况下,iPhone或IPAD就会触发AirPlay功能.我们可以通过在电脑上安装支持AirPlay的软件来间接实现这个功能! 使用工具:手机&网络 方法一:手机自带屏幕录制 1.打开iphone手机,进入设置,选择控制中心: 2.在控制中心中,选择自定控制: 3.在自定控制,选择屏幕录制,点击左侧的添