arozwalak
1/22/2015 - 9:51 AM

Javascript: viewport width and height

Javascript: viewport width and height

function viewport () {
    var e = window, a = 'inner';
    if (!('innerWidth' in window )) {
        a = 'client';
        e = document.documentElement || document.body;
    }
    return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
}