Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
조회 수 19355 댓글 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>
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
753 | Develop | [c++] 기초강좌 #02(레퍼런스,메모리할당) | hooni | 2003.04.23 | 11418 |
752 | Develop | [c++] 기초강좌 #01(입출력,영역지정) | hooni | 2003.04.23 | 11396 |
751 | Develop | [c++] mfc 조건별 파일 검색 프로그램 소스 ㅋㅋ 19 | hooni | 2013.04.23 | 11389 |
750 | Develop | [switch] 시스코 카탈리스트(Cisco Catalyst) 2950 미러링 설정 | hooni | 2013.04.23 | 11386 |
749 | System/OS | [linux] GD 라이브러리 설치 방법.. | hooni | 2013.04.23 | 11362 |
748 | System/OS | [linux] vi 편집기 간단한 명령과 환경설정 | hooni | 2003.04.23 | 11356 |
747 | Develop | [js] 인터넷 주소(URL) 인코딩 ㅋㅋ | hooni | 2013.04.23 | 11347 |
746 | Develop | [spring] 스프링 IoC/DI | hooni | 2013.04.23 | 11345 |
745 | System/OS | [linux] iptables 명령어 매뉴얼(options) | hooni | 2003.04.23 | 11325 |
744 | Develop | [js] 한글주소(URL) 인코딩(encode, Encoding), 자바스크립트(JavaScript) | hooni | 2013.04.23 | 11324 |
743 | Develop | [switch] 시스코 스위치(catalyst 2950) telnet 설정 | hooni | 2013.04.23 | 11268 |
742 | Develop | [ios] iOS In App Purchase 코드 부분 샘플 2 | hooni | 2013.11.20 | 11266 |