Created
May 14, 2016 16:29
-
-
Save adastreamer/db92e8cd5d584a3ecc9710fa7c846b4b to your computer and use it in GitHub Desktop.
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
if ( jQuery.isWindow( elem ) ) { | |
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode | |
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat | |
var docElemProp = elem.document.documentElement[ "client" + name ], | |
body = elem.document.body; | |
return elem.document.compatMode === "CSS1Compat" && docElemProp || | |
body && body[ "client" + name ] || docElemProp; | |
// Get document width or height | |
} else if ( elem.nodeType === 9 ) { | |
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater | |
return Math.max( | |
elem.documentElement["client" + name], | |
elem.body["scroll" + name], elem.documentElement["scroll" + name], | |
elem.body["offset" + name], elem.documentElement["offset" + name] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment