媒体查询iphone4,5,6以及更高
2017-07-17 00:00
239 查看
摘要: 媒体查询 iphone
/* iphone4*/
@media screen and (device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2){
.dialog-agreement-con{
height: 45%;/* iphone4*/
}
}
;/* iphone5*/
@media screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2){
.dialog-agreement-con{
height: 55%;/* iphone5*/
}
}
/* iphone6竖屏*/
@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) {
.dialog-agreement-con{
height: 60%;/* iphone6竖屏*/
}
}
/* iphone6 plus竖屏*/
@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;
/* iphone4*/
@media screen and (device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2){
.dialog-agreement-con{
height: 45%;/* iphone4*/
}
}
;/* iphone5*/
@media screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2){
.dialog-agreement-con{
height: 55%;/* iphone5*/
}
}
/* iphone6竖屏*/
@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) {
.dialog-agreement-con{
height: 60%;/* iphone6竖屏*/
}
}
/* iphone6 plus竖屏*/
@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;
相关文章推荐
- ie11媒体查询以及其他hack
- 媒体查询,移动端常见布局以及其他
- 常用媒体查询以及手机横竖屏监听
- css媒体查询iphone4和iphone5
- 关于IE8以及以下版本不支持媒体查询的解决方案
- CSS笔记(盒模型以及媒体查询)
- 媒体查询media参数以及其兼容性问题
- 响应式布局与媒体查询,以及像素以及查看各种分辨率下显示效果的工具
- SQL Server 海量数据查询代码优化以及建议
- 使用 CSS 媒体查询创建响应式网站 适用于所有屏幕大小的设计
- sql server 和 oracle查询列名以及列数
- elasticsearch核心知识--42.多搜索条件组合查询,sort以及explain的用法
- css3的@media媒体查询
- mongo 数据导出到mysql 以及常用查询
- Oracle 查询表大小以及表空间使用率
- 响应式设计之媒体查询一
- 调整并行查询性能所需要查看的视图以及其中涉及的统计视图
- Mysql的时间查询以及赋值
- BLOB和CLOB的区别以及在ORALCE中的插入和查询操作
- 获得在查询分析器里执行程序的精确时间以及查询效率问题