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>
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
733 | Develop | [ios] 최상위 ViewController 가져오기 | hooni | 2015.10.12 | 1067 |
732 | Develop | DDay Memo 1.9.4 소스코드 | hooni | 2015.10.03 | 0 |
731 | Develop | [ios] How to set up clang formatter | hooni | 2015.09.17 | 1364 |
730 | Develop | [ios] SBCampanion App 초안 | hooni | 2015.09.16 | 660 |
729 | Develop | [git] 쉬운 버전관리 Git 설명 | hooni | 2015.08.18 | 878 |
728 | Develop | [ios] 오브젝티브C→스위프트, 코드 변환 손쉽게 | hooni | 2015.08.07 | 963 |
727 | Develop | [ios] Objective-C Types & Storage Capacity | hooni | 2015.07.22 | 1159 |
726 | Develop | [ios] AES256 알고리즘을 이용해 데이터 암호화/복호화 방법 | hooni | 2015.07.21 | 4107 |
725 | Develop | [ios] NSData to NSString (NSString to NSData) | hooni | 2015.07.21 | 640 |
724 | Develop | [ios] WWDC 2015 샘플 소스 코드 통합파일 | hooni | 2015.07.20 | 665 |
723 | Develop | [android] N-Puzzle 게임 | hooni | 2015.07.09 | 871 |
722 | Develop | [android] 코드에서 문자열로 Resource 가져오기 | hooni | 2015.07.09 | 3948 |