Skip to content

Instantly share code, notes, and snippets.

@rainyjune
Last active August 29, 2015 14:05
Show Gist options
  • Save rainyjune/9a8bad1efa7e97c3b17f to your computer and use it in GitHub Desktop.
Save rainyjune/9a8bad1efa7e97c3b17f to your computer and use it in GitHub Desktop.
CSS dimensions
/* Firefox /NS6 properties for determining browser dimension */
window.innerHeight; // Returns the physical height of the browser screen
window.innerWidth; // Returns the pyhsical widht of the browser screeen
/* IE 4+ properties for determining browser dimension */
document.body.clientWidht; // Returns physical width of the browser screen
document.body.clientHeight; // Returns the physical height of the browser screen
/* Firefox / NS6+ properties for determining DSOC */
window.pageXOffset; // Returns the x coordinate of the DSOC
window.pageYOffset; // Returns the y coordinate of the DSOC
/* IE 4+ properties for determining DSOC */
document.body.scrollLeft; // Returns the x coordinate of the DSOC
document.body.scrollTop; // Returns the y coordinate of the DSOC
/* Document.body and doctype */
var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
var dsocleft=document.all? iebody.scrollLeft : pageXOffset
var dsoctop=document.all? iebody.scrollTop : pageYOffset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment