일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- Injection
- euc-kr
- 크로스 컴파일
- synology
- RTL88x2BU
- jquery 레이어
- PHP GCM
- submit
- utf-8
- readonly
- jQuery
- AC1300
- 무선랜카드
- 커널
- include
- form
- XMLHTTP
- println
- replace
- disabled
- ASP
- Getrows
- lsusb
- SQL Injection
- javascript
- 시놀로지
- DS718+
- FileSystemObject
- 따라다니는 배너
- ajax
- Today
- Total
아는 것이 좋은 것이다.
[JavaScript] 브라우저별 해상도 구하기 본문
<script type="text/javascript">
<!--
//alert(window.innerWidth);
//alert(document.documentElement.clientWidth);
var w = 0, h = 0;
if (typeof (window.innerWidth) == 'number') { //Chrome
w = window.innerWidth / 2;
//h = window.innerHeight / 2;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
w = document.documentElement.clientWidth / 2;
//h = document.documentElement.clientHeight / 2;
} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { //IE
w = document.body.clientWidth / 2;
//h = document.body.clientHeight / 2;
}
//alert("w=" + w + ", h=" + h);
//alert(document.getElementById('floater').style.left);
document.getElementById('floater').style.left = w + 480 +"px";
//-->
</script>
'JavaScript' 카테고리의 다른 글
[JavaScript] 숫자 앞에 원하는 자릿수만큼 0 붙이기 (0) | 2014.06.16 |
---|---|
[JavaScript] 클릭 이벤트가 발생한 바로 그 위치 (0) | 2014.06.10 |
[JavaScript] 확인 취소 스크립트 (0) | 2014.05.27 |
[JavaScript] 모바일 회전 감지 스크립트 (2) | 2014.05.27 |
[JavaScript] 게시판 상세내용 열고 닫기 (0) | 2014.05.15 |