Created
October 24, 2012 03:45
-
-
Save vexus2/3943570 to your computer and use it in GitHub Desktop.
[Javascript]ブラウザの縦幅、横幅をそれぞれ取得する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getScreenSize() { | |
| var obj = new Object(); | |
| if (!isSafari && !isOpera) { | |
| obj.x = document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth; | |
| obj.y = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight; | |
| } else { | |
| obj.x = window.innerWidth; | |
| obj.y = window.innerHeight; | |
| } | |
| obj.mx = parseInt((obj.x)/2); | |
| obj.my = parseInt((obj.y)/2); | |
| return obj; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment