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,263
  • 1
  • 30
  • 52
sar
  • 1,287
  • 3
  • 20
  • 41
  • 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
  • 935
  • 9
  • 26
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
  • 437
  • 4
  • 19
0

Returns height of browser viewport

$(window).height(); 

Returns height of HTML document

$(document).height();
Igor Escobar
  • 997
  • 1
  • 10
  • 13