[출처] http://blog.naver.com/PostView.nhn?blogId=hanoora&logNo=110177880101&redirect=Dlog&widgetTypeCall=true
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript">
jQuery("document").ready(function() {
jQuery(window).trigger("orientationchange"); // 최초 페이지 로딩 시 가로, 세로를 모르기 때문에 trigger로 처리
});
jQuery(window).bind("orientationchange", function(e) { // 가로세로 전환 처리
var orientation = window.orientation;
if (orientation == 90 || orientation == -90) {
alert("portrait");
} else {
alert("landscape");
}
});
jQuery(window).bind("resize", function()) { // 화면 리사이즈 처리
// 이 경우의 처리는 대부분 가로냐 세로냐의 판단보다는 화면 폭 등을 가져와서 처리하는 경우가 많다.
var i_tw = document.body.clientWidth;
// 아니면 특정 element 의 폭이나 높이를 가져와야 하는 경우도 있다.
var i_tw = jQuery("#item1").css("width");
var i_th = jQuery("#item1").css("height");
});
</script>
[출처] [mobile]가로, 세로 전환 및 화면크기 변경시 처리|작성자 하누라
'script' 카테고리의 다른 글
swap memory used check in sh (0) | 2014.07.03 |
---|---|
JAVACRIPT 와 PHP 간 암호화 복호화 연동 (0) | 2014.06.27 |
pc 표준시간대 변경에 따른 javascript 현재시간 조정 (0) | 2014.04.08 |
javascript 동적 css 파일 반영 (0) | 2014.03.11 |
SharePoint ribbon default change (0) | 2014.01.24 |
댓글