Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
조회 수 19360 댓글 0
<!DOCTYPE html>
<html>
<head>
<title>Orientation Checker</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximumscale=1.0; user-scalable=0;" />
<script type="text/javascript" src="/js/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
/*
* ios, android 둘다 지원되는 스크립트
*/
var ori_status;
$(document).ready(function() {
window.onorientationchange = changeOrientation;
window.setTimeout(changeOrientation, 0);
});
// event handler
function changeOrientation(){
if(ori_status == detectOrientation())return;
ori_status = detectOrientation();
alert(ori_status);
}
function detectOrientation(){
var orientation = window.orientation;
var rtn;
switch(orientation) {
case 90: case -90:
rtn = 'landscape';
break;
default:
rtn = 'portrait';
}
return rtn;
}
</script>
</head>
<body>
</body>
</html>
-
[mac] Homebrew/rvm/cocoapod setting
-
[mac] Charlesproxy 간단한 설정 내용~
-
[macos] How to Fix ‘You Shut Down Your Computer Because of a Problem’
-
[linux] 한글 URL 인식할 수 있게 아파치(Apache) 설정 (mod_url.c 설치)
-
[linux] 프로세스의 stat 상태에 대한 설명
-
[linux] 프로세스 상태확인(ps)
-
[linux] 프로세스 관련 시스템콜
-
[linux] 프로그램 설치방법 (내공쌓기)
-
[linux] 패킷의 소스 주소 바꾸기
-
[linux] 패킷 스니퍼링
-
[linux] 파일내 문자열 찾아 바꾸기
-
[linux] 특정 문자열 포함된 파일 찾는 명령어