Javascript: How to calculate the exact position of the viewport?

Posted by batmanfu on Stack Overflow See other posts from Stack Overflow or by batmanfu
Published on 2010-05-20T04:00:40Z Indexed on 2010/05/20 4:10 UTC
Read the original article Hit count: 173

Filed under:
|
|

My problem is I need to get the position of the viewport relative to the extent of the entire document. I am only concerned with Firefox.

My issue is that everything I have read says that:

viewport height is window.innerHeight
scroll position is window.pageYOffset
document total height is document.height

So, I would expect that if I scrolled to the bottom of a page that window.innerHeight + window.pageYOffset = document.height

But it doesn't! Can someone please explain to me why this is?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firefox