Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Determine the dimensions of the window or elements
function element_WH(elem){
var res={};
res.width = window.innerWidth || html.clientWidth || body.clientWidth || screen.availWidth;
res.height = window.innerHeight || html.clientHeight || body.clientHeight || screen.availHeight;
res.width = elem.innerWidth || elem.clientWidth;
res.height = elem.innerHeight || elem.clientHeight ;;
return res;
element_WH(document.getElementById("someId")); //return JSON, element width and height
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment