Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
조회 수 19422 댓글 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>
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
565 | Develop | 프로그래밍에서 foo, bar 함수의 유래 | hooni | 2013.06.25 | 21446 |
564 | Develop | [ios] 패스(path) 앱 메뉴 스타일 | hooni | 2013.06.11 | 0 |
563 | Develop | [ios] 스터디 자료 (from 종길M) | hooni | 2013.06.04 | 0 |
562 | Develop | [ios] IB 없이 개발하기 (html) | hooni | 2013.05.31 | 0 |
561 | Develop | [iphone] PerfectlyClear 보정솔루션 최신.. | hooni | 2013.05.28 | 0 |
560 | Develop | [Android] 2010년에 만들었던 세미나 자료. | hooni | 2013.05.28 | 64728 |
559 | Develop | [js] 자바스크립트의 클로저 (JavaScript's Closure) | hooni | 2013.05.15 | 13011 |
558 | Develop | 서기의 PHP 동영상 강의(싱싱해) | hooni | 2013.05.15 | 31042 |
» | Develop | [js]모바일 웹에서 orientationchange | hooni | 2013.04.23 | 19422 |
556 | Develop | [android] keytool을 사용하여 키스토어 생성 | hooni | 2013.04.23 | 69571 |
555 | Develop | [js] 모바일웹에서 이미지 저장하는거 (context menu) 막기 | hooni | 2013.04.23 | 26416 |
554 | Develop | [js] JSON 컨트롤.. 재귀호출로 값 출력하기 | hooni | 2013.04.23 | 28668 |