var w = 0, h = 0; if (typeof (window.innerWidth) == 'number') { //Chrome w = window.innerWidth / 2; h = window.innerHeight / 2; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { w = document.documentElement.clientWidth / 2; h = document.documentElement.clientHeight / 2; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { //IE9 w = document.body.clientWidth / 2; h = document.body.clientHeight / 2; } |