Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
조회 수 19357 댓글 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>
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
289 | Develop | [c] 다중연결 서버 만들기 #2 - select() 사용 | hooni | 2013.04.23 | 9361 |
288 | Develop | [c] 공용체를 이용해 MSB를 LSB로 변환 | hooni | 2013.04.23 | 9374 |
287 | Develop | [js] jQuery 셀랙터(selector) 요약 | hooni | 2013.12.17 | 9414 |
286 | Develop | [java] 스윙(swing)버튼 테스트 ㅋㅋ | hooni | 2013.04.23 | 9421 |
285 | Develop | [java] 거스름돈 계산.. swing 사용 | hooni | 2013.04.23 | 9442 |
284 | Develop | [c] 팩토리얼.. - 재귀함수 | hooni | 2003.04.23 | 9500 |
283 | Develop | [c] 파일(File)의 연결과 연결 해제 (link, unlink, chown) | hooni | 2013.04.23 | 9543 |
282 | Develop | [c++] 링크리스트(linked list) 클래스(스택,큐) | hooni | 2003.04.23 | 9553 |
281 | Develop | [c++] 마방진 소스코드 | hooni | 2013.04.23 | 9558 |
280 | Develop | [js] Closure를 이용해 캡슐화.. | hooni | 2013.12.16 | 9590 |
279 | Develop | [c] 이진트리(binary tree)의 특성 | hooni | 2003.04.23 | 9594 |
278 | Develop | OpenGL 강좌 사이트 모음 | hooni | 2013.04.23 | 9637 |