Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery web page height

Let's say that a web page is twice the height of the browser window (thus there's a scroll bar). How do I retrieve the height of the web page in jQuery?

like image 612
core Avatar asked Aug 20 '09 06:08

core


People also ask

How to set height of element jQuery?

jQuery height() Method The height() method sets or returns the height of the selected elements. When this method is used to return height, it returns the height of the FIRST matched element. When this method is used to set height, it sets the height of ALL matched elements.

How to get browser window size in jQuery?

$(window). resize(function() { // This will execute whenever the window is resized $(window). height(); // New height $(window). width(); // New width });

What is jQuery height?

The height() is an inbuilt method in jQuery which is used to check the height of an element but it will not check the padding, border and margin of the element. Syntax: $("param").height() Parameters : This function do not accept any parameter. Return value : It returns height of the selected element.

How do I set dynamic height in jQuery?

Answer: Use the JavaScript height() method You can set the height of a <div> box dynamically using the jQuery height() method.


2 Answers

$(window).height();   // returns height of browser viewport  $(document).height(); // returns height of HTML document 
like image 84
rahul Avatar answered Oct 19 '22 23:10

rahul


You could use the height() of the document.

$(document).height();

like image 44
theIV Avatar answered Oct 19 '22 23:10

theIV