Get client screen size in a browser by Javascript
using this simple code you can have the size of your client area in pix
1 2 3 4 5 6 7 8 9 10 11 |
function getScreenSize() { var w = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0], x = w.innerWidth || e.clientWidth || g.clientWidth, y = w.innerHeight|| e.clientHeight|| g.clientHeight; return x + 'px ' + y + 'px'; } |
1 |
window.addEventListener('resize',<yourFuncName>); |