Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
Views 19432 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>
-
[opengl] 컴퓨터 그래픽스 강의 자료(수업자료)
-
[android] [번역] 안드로이드 Android Cloud to Device Messaging(C2DM)
-
[php] substr() 한글 자를 때 깨짐 방지
-
[ios] UIView에서 상위 UIViewController 가져오기
-
[c] UTF-8을 EUC-KR로 변환.. (iconv)
-
[c] AES 알고리즘 (암호화/복호화)
-
[php] XE 에서 php 구문 사용하기 (XE 템플릿에서)
-
[js]모바일 웹에서 orientationchange
-
모터에 대한 pid 제어.. ㅎㅎ
-
URI 인코딩, URL 인코딩
-
[ios] Objective-C에서 형식이 있는 문자열(Format Strings)에 사용할 수 있는 토큰들(Tokens)
-
[ios] libxml/tree.h file not found