Last Updated: September 09, 2019
· joaco182

How to determine if a scrollable element has been scrolled to the bottom

$(element).scroll(function () {
    var scrollH = $(this)[0].scrollHeight;
    var clientH = $(this)[0].clientHeight;
    var offset = scrollH - clientH;

    if (offset == $(this).scrollTop()) {
         * action to perform when scrollable 
         *  area hits bottom

You would think something this simple would be easy to find.

I did test in the latest browsers for Chrome, Firefox, and Safari (sorry IE) on a Mac and it appears stable.

Should also mention that jQuery-1.9.1 was used to generate the example.

2 Responses
Add your response

Thanks for the tip, using syntax highlighting might make it easier to grok.

over 1 year ago ·

@posbo Thanks for the suggestion. Hope that helps.

over 1 year ago ·