Develop
2013.04.23 18:11
[js]모바일 웹에서 orientationchange
조회 수 19419 댓글 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>
-
[c] 64bit 머신에서 inet_ntoa() 사용시 Segment fault 대처 방법법
-
[ios] NSString 간단한 정규식 사용법
-
[ios] iOS 6.0 이상 회전 하기 (이전 버전과 비교 변경 부분)
-
[ios] 네트워크 인디케이터(NetworkActivityIndicator) 작동
-
[js] 주소표시줄 URL 읽어오기 (변경까지)
-
[linux] CentOS 6.x Cati 설치 (yum)
-
[ios] UIWebView에서 NSURLRequest에 Cookie 실어 보내기
-
[ios] UIWebView 쿠키 유지
-
[php] substr() 한글 자를 때 깨짐 방지
-
[linux] iconv를 이용하여 euc-kr 문서를 utf-8로 대량으로 변환하기
-
[ios] UIButton multi-line iOS7
-
iOS 에서 쓸만한 오프라인 구글지도 찾기