Created
April 11, 2017 06:09
-
-
Save TLMcode/ea4c7182156b76f2c92a2979993f2eaf to your computer and use it in GitHub Desktop.
Private anon init function for returning a client view port dimensions array.
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
| GetViewportDimension: function() | |
| { | |
| var ViewPortArr = []; | |
| // Standards compliant client | |
| if ( typeof window.innerWidth != 'undefined' ) | |
| { | |
| ViewPortArr.Width = window.innerWidth | |
| ViewPortArr.Height = window.innerHeight | |
| } // IE6 compliant mode | |
| else if ( typeof document.documentElement != 'undefined' | |
| && typeof document.documentElement.clientWidth != | |
| 'undefined' && document.documentElement.clientWidth != 0 ) | |
| { | |
| ViewPortArr.Width = document.documentElement.clientWidth | |
| ViewPortArr.Height = document.documentElement.clientHeight | |
| } // IE6 older, other | |
| else | |
| { | |
| ViewPortArr.Width = document.getElementsByTagName( 'body' )[0].clientWidth | |
| ViewPortArr.Height = document.getElementsByTagName( 'body' )[0].clientHeight | |
| } | |
| return ViewPortArr; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment