Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
Views 19430 Comment 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>
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
145 | Develop | [js] 후리자(영규) 스타일들.. | hooni | 2013.04.23 | 7180 |
» | Develop | [js]모바일 웹에서 orientationchange | hooni | 2013.04.23 | 19430 |
143 | Develop | [kotlin] 코틀린 안드로이드 앱 버전/빌드 정보 | hooni | 2020.12.15 | 987 |
142 | Develop | [lego] 세그웨이 이것만 볼것.. ㅎㅎ | hooni | 2013.04.23 | 33585 |
141 | Develop | [linux] CentOS Apache 웹서버에 HTTPS 적용 | hooni | 2015.10.23 | 922 |
140 | Develop | [linux] crond 사용법.. ㅋㅋ | hooni | 2013.04.23 | 7277 |
139 | Develop | [linux] tar 명령어 뽀개기.. ㅋㅋ | hooni | 2003.04.23 | 7814 |
138 | Develop | [linux] 날짜나 파일의 내용으로 검색하는 방법(find 명령 사용) | hooni | 2013.04.23 | 8156 |
137 | Develop | [linux] 쉘 스크립트를 이용한 BBS | hooni | 2003.04.23 | 10081 |
136 | Develop | [linux] 임베디드 리눅스 (embedded linux) | hooni | 2013.04.23 | 7384 |
135 | Develop | [linux] 프로세스 관련 시스템콜 | hooni | 2003.04.23 | 7875 |
134 | Develop | [matlab] ZigZag-Scanning (2-D Array) | hooni | 2016.10.15 | 2116 |