Created
March 10, 2023 01:44
-
-
Save solanoize/5d89a1faa0ee22db270ba33cd5dd7b7b 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
| function getWindowDims() { | |
| let docs = document, | |
| win = window; | |
| let docsEl = (docs.compatMode && docs.compatMode === 'CSS1Compat') ? | |
| docs.documentElement : docs.body; | |
| let width = docsEl.clientWidth; | |
| let height = docsEl.clientHeight; | |
| if (win.innerWidth && width > win.innerWidth) { | |
| width = win.innerWidth; | |
| height = win.innerHeight; | |
| } | |
| return { | |
| width: width, | |
| height: height | |
| }; | |
| } | |
| let win = getWindowDims(); | |
| console.log(win); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment