Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get full window height when there is a scroll bar?

Tags:

jquery

var window_height = $( window ).height(); this is giving current window height not the full height including scroll height. I want full window height including scroll height.

like image 287
Samiul Avatar asked Jan 30 '14 11:01

Samiul


2 Answers

You should check this link: How to get height of entire document with JavaScript?

    var body = document.body,
    html = document.documentElement;

var height = Math.max( body.scrollHeight, body.offsetHeight, 
                       html.clientHeight, html.scrollHeight, html.offsetHeight );
like image 83
Niki Sharma Avatar answered Oct 19 '22 02:10

Niki Sharma


As of 2020 the best way to find the height of an entire document is:

document.documentElement.scrollHeight

Credit: this answer on another question.

like image 3
Max Stevens Avatar answered Oct 19 '22 02:10

Max Stevens