reddy
reddy

Reputation: 1831

$(document.body).height() returns the same value as $(window).height()

my basic structure was like this:

<body>
    <div id="controlBar"></div>
    <div id="placeholder"></div>
    <div id="pageHeader">
      <nav><ul><li><li></ul></nav>
    </div>
    <section id="pageContent"></section>
    <footer id="pageFooter"></footer>
</body>

where #controlBar has a fixed position and #placeholder has the same height as #controlBar. The combine height inside the body was about 400px.

I'm trying to get the height of the body using $(document.body).height(), but the value returned was the same as $(window).height(), which is over 900px. I also tried $(document).height(), but still same result.

Upvotes: 1

Views: 1150

Answers (1)

davids
davids

Reputation: 6371

If you'd like to know the actual size of the window you could check it like this:

window.innerHeight

Upvotes: 1

Related Questions