转:window.orientation判断移动设备横屏竖屏
通过window.orientation来判断设备横竖屏
function checkOrient() { if (window.orientation == 0 || window.orientation == 180){
var screenOrientation = 'portrait';
}
else if (window.orientation == 90 || window.orientation == -90){
var screenOrientation = 'landscape';
}
return screenOrientation;
}
// 添加事件监听
addEventListener('load', function(){
checkOrient();
window.onorientationchange = checkOrient;
}); 注:landscape是横向,portrait是纵向 转自:http://www.best-html5.net/?p=661
转:window.orientation判断移动设备横屏竖屏的更多相关文章
- javascript判断手机旋转横屏竖屏
javascript判断手机旋转横屏竖屏 // 横屏竖屏函数 function orientationChange(){ switch(window.orientation) { case 0: // ...
- 查看,设置,设备的 竖屏-横屏模式 screen.orientation
<body> <div id="doc"></div> <div id="model"></div> ...
- HTML5中判断横屏竖屏
在移动端中我们经常碰到横屏竖屏的问题,那么我们应该如何去判断或者针对横屏.竖屏来写不同的代码呢. 这里有两种方法: 一:CSS判断横屏竖屏 写在同一个CSS中 1 2 3 4 5 6 @media s ...
- js 横屏 竖屏 相关代码 与知识点
<!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...
- vue手机端横屏竖屏切换
1.建一个空白的vue文件,添加上如下代码 data() { this.$router.go(-1) return {} } 2.在需要横屏竖屏切换的页面中加入如下代码: beforeMount( ...
- RK3288 6.0 双屏异显,横屏+竖屏【转】
本文转载自:http://blog.csdn.net/clx44551/article/details/78215730?locationNum=8&fps=1 RK3288 6.0 双屏异显 ...
- Android横屏竖屏切换的问题
Android横屏竖屏切换的问题 http://blog.sina.com.cn/s/blog_77c632410101790w.html
- 【转】Android 模拟器横屏竖屏切换设置
http://blog.csdn.net/zanfeng/article/details/18355305# Android 模拟器横屏竖屏切换设置时间:2012-07-04 来源:设计与开发 ...
- Android之横屏竖屏显示问题
1.採用不同的布局文件 在res下创建目录layout-land 在该目录下写入的layout(xml文件)横屏的时候系统自己主动选择显示的layout 同理: 在res下创建目录layout-por ...
随机推荐
- 关于Mybatis 的 Mapped Statements collection does not contain value for 异常 解决方案
查看堆栈信息: at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:595) at org.apac ...
- sublime+LatexTools引用参考文献
在用sublime+LatexTools一段时间之后,发现用它来写Latex真的是非常方便,配置好TexLive之后直接CTRL+B就可以直接编译运行了,so cool!但是最近写课程论文的时 ...
- python 进程锁
1. #_*_coding:utf-8_*_ from multiprocessing import Process,Lock import os,time def f(l,i): #加锁 l.acq ...
- IdentityServer3零星笔记
Scope 是什么?有哪几种类型?每种类型都怎么使用? StandardScopes.All是什么概念? 解释:在Scope的Claims属性里包含的所有声明(类型是ScopeClaim,它的name ...
- 区间数字的按位与 Bitwise AND of Numbers Range
2018-08-13 22:50:51 问题描述: 问题求解: 首先如果m 和 n不相等,那么必然会有至少一对奇偶数,那么必然末尾是0. 之后需要将m 和 n将右移一位,直到m 和 n相等. 本质上, ...
- Xshell Xftp 免费版 (xshell6 评估期已过 解决办法)
xshell6 评估期已过,因为下载的版本是evaluation版本,是有期限的. 大家可以修改为Home and school use 的版本,这样就不会出现这个提示了. 具体的操作步骤如下: 1. ...
- Asp.Net中的sessionState设置
在web.config中有sessionState的节点配置,sessionState共有4中模式:off,inProc,StateServer,SqlServer. 1. off模式 关闭模式,如果 ...
- codefroces 450B矩阵快速幂
找出递推关系式就好了 (fi+1)=(1 -1)(fi ) ( fi)=(1 0)(fi-1) 不会打矩阵将就着看吧... 这是第一道矩阵快速幂.细节还是有很多没注意到的 本来想看挑战写 ...
- python-day8-赋值
# x=10 #链式赋值# a=b=c=d=e=f=10# print(a,b,c,d,e,f) #增量赋值 # x=10# y='a'# temp=x# x=y# y=temp# print(x,y ...
- 37. Sudoku Solver *HARD*
Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by th ...