2

I want to know how to get page`s total height and width considering its scrolling. right now I am using

height1= screen.availHeight;
width1=screen.availWidth;

but when page scroll it is not useful.. is there another way in JavaScript?

Allan Kimmer Jensen
  • 4,333
  • 2
  • 31
  • 53
sar
  • 1,277
  • 3
  • 21
  • 48
  • yeah I saw that. So you read the Question title that I comment?? ` How to get document height and width **without using jquery**` – Blu Apr 03 '14 at 12:48
  • getting height and width without jquery like this height = document.body.clientHeight; width = document.body.clientWidth; – Pratik Parekh Apr 03 '14 at 12:53

3 Answers3

0

Maybe you can try this:

var body = document.body;
var height = Math.max( body.scrollHeight, body.offsetHeight);
var width= Math.max( body.scrollWidth, body.offsetWidth);
patricK
  • 1,045
  • 11
  • 27
0

if you want to get height and width try this

this is for full HTML page using jquery

$(document).height();
$(document).width();

and this is for only window

$(window).height();
$(window).width();
Pratik Parekh
  • 447
  • 4
  • 19
0

Returns height of browser viewport

$(window).height(); 

Returns height of HTML document

$(document).height();
Igor Escobar
  • 1,047
  • 1
  • 12
  • 13