Oldal szélességének és magasságának lekérése
var getDocumentDimension = function () { var els, dim; els = { html: document.documentElement, body: document.body }; dim = { width: Math.max( els.html.scrollWidth, els.html.clientWidth, els.html.offsetWidth, els.body.scrollWidth, els.body.offsetWidth ), height: Math.max( els.html.scrollHeight, els.html.clientHeight, els.html.offsetHeight, els.body.scrollHeight, els.body.offsetHeight ) }; return dim; }; var d = getDocumentDimension(); console.log('Width: ' + d.width); console.log('Height: ' + d.height);
Forrás
How to get height of entire document with JavaScript?
















