Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
Views 19425 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 |
---|---|---|---|---|---|
441 | Develop | [node.js] nodejs 기본 설치 | hooni | 2013.04.23 | 26320 |
440 | Develop | [node.js] 지금 하고 있는거.. | hooni | 2013.04.23 | 27023 |
439 | Develop | [iphone] 파일 업로드 샘플 코드 ㅎㅎ | hooni | 2013.04.23 | 11120 |
438 | Develop | [js] JSON 컨트롤.. 재귀호출로 값 출력하기 | hooni | 2013.04.23 | 28669 |
437 | Develop | [js] 모바일웹에서 이미지 저장하는거 (context menu) 막기 | hooni | 2013.04.23 | 26419 |
436 | Develop | [android] keytool을 사용하여 키스토어 생성 | hooni | 2013.04.23 | 69572 |
» | Develop | [js]모바일 웹에서 orientationchange | hooni | 2013.04.23 | 19425 |
434 | System/OS | 맥에서 파일공유 (윈도우,맥) | hooni | 2013.04.25 | 37397 |
433 | System/OS | [mysql] mysql user 생성시 ERROR 1364 | hooni | 2013.04.25 | 28601 |
432 | System/OS | Mac OS X - Apache+PHP+MySQL 환경 서버 | hooni | 2013.04.25 | 31711 |
431 | Etc | 영어공부에 도움될만한 사이트 모음 | hooni | 2013.05.14 | 22685 |
430 | Develop | 서기의 PHP 동영상 강의(싱싱해) | hooni | 2013.05.15 | 31042 |