Determining when scrolled to bottom of a page with Javascript

Posted by chimerical on Stack Overflow See other posts from Stack Overflow or by chimerical
Published on 2010-05-12T08:20:26Z Indexed on 2010/05/12 8:24 UTC
Read the original article Hit count: 329

Filed under:

I'm trying to determine when I've scrolled to the bottom of the page (without using any JS library), but so far, I'm a bit confused over which one of the following to use. The most promising one I've seen is window.scrollY, but even when scrolled to the bottom of the page, it never matches the value of window.innerHeight. What's the best way to do this?

window.innerWidth
window.innerHeight

window.outerWidth
window.outerHeight

window.scrollX
window.scrollY

document.body.scrollWidth
document.body.scrollHeight
document.body.scrollTop
document.body.scrollLeft

document.body.offsetTop
document.body.offsetLeft
document.body.offsetWidth
document.body.offsetHeight

© Stack Overflow or respective owner

Related posts about JavaScript