Skip to content

Instantly share code, notes, and snippets.

@adastreamer
Created May 14, 2016 16:20
Show Gist options
  • Save adastreamer/5642a37c5ba6c4317db89a18e5170faa to your computer and use it in GitHub Desktop.
Save adastreamer/5642a37c5ba6c4317db89a18e5170faa to your computer and use it in GitHub Desktop.
var getHeight = function(){
var viewport = new Object();
viewport.height = 0;
// the more standards compliant browsers (mozilla/netscape/opera/IE7)
//use window.innerWidth and window.innerHeight
if (typeof window.innerHeight != 'undefined')
{
viewport.height = window.innerHeight
}
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientHeight !=
'undefined' && document.documentElement.clientHeight != 0)
{
viewport.height = document.documentElement.clientHeight
}
else
{
viewport.height = document.getElementsByTagName('body')[0].clientHeight
}
return viewport.height;
};
var docHeight = getHeight();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment