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>
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
145 | Develop | [php][laravel] 초간단 MacOS에서 Laravel 개발 환경 구축 | hooni | 2017.12.15 | 2090 |
144 | Develop |
[c#] mfc 기반의 웹서비스 서버/클라이언트 샘플과 예제 소스
![]() |
hooni | 2013.04.23 | 2073 |
143 | Develop |
[ios] 카테고리 확장 메소드를 찾지 못하는 경우
![]() |
hooni | 2014.08.08 | 2071 |
142 | Develop |
[ios] 웹뷰 history.back() ㅋㄷ
![]() |
hooni | 2016.06.27 | 2010 |
141 | Develop |
[android] 가속도 센서를 이용한 흔듦(Shake) 감지
![]() |
hooni | 2014.11.04 | 1994 |
140 | Develop | [swift] UIView에서 subview 찾기 | hooni | 2022.12.09 | 1993 |
139 | Develop |
[iOS] 시뮬레이터에 푸시 알림을 보내는 방법
![]() |
hooni | 2021.10.13 | 1971 |
138 | Develop | [ios] Objective-C 에서 자주 사용하는 수학 함수와 유용한 Define | hooni | 2014.08.08 | 1961 |
137 | Develop | [ios] 카메라 사용 권한 확인해서 분기하는 방법 | hooni | 2015.02.26 | 1946 |
136 | Develop | [iOS] Xcode 불필요한 캐시 삭제하기 | hooni | 2021.10.12 | 1939 |
135 | Develop | [ios] Xcode cannot run using the selected device | hooni | 2014.08.14 | 1876 |
134 | Develop | [php] mysql_ 과 mysqli_ 의 차이 | hooni | 2017.12.01 | 1822 |