Home:ALL Converter>How to detect when you are at the bottom of scrollable div?

How to detect when you are at the bottom of scrollable div?

Ask Time:2013-01-30T00:42:56         Author:ORStudios

Json Formatter

I am having trouble detect when I am at the bottom of a scrollable div. I have a div that is absolute positioned, the div is set to 100% height and is scrollable. The div contains numerous articles one below the other.

My aim is to detect when the div has been scrolled to the bottom. I am using the following code for testing but the value for the scroll.height does not add up because it is giving me the height of the browser window instead of the height of the scrollable content.

$('#scroll_length').text($('.scroll').scrollTop() + ' -- ' + $('.scroll').innerHeight());

Any ideas?

Author:ORStudios,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14587799/how-to-detect-when-you-are-at-the-bottom-of-scrollable-div
Christian :

I answered a similar question a while ago, and I believe it is still relevant: Using jQuery, how do I force a visitor to scroll to the bottom of a textarea to enable the submit button?\n\n$('#terms').scroll(function () {\n if ($(this).scrollTop() == $(this)[0].scrollHeight - $(this).height()) {\n $('#register').removeAttr('disabled');\n }\n});\n\n\nSimply give terms an id, and set the register button to disabled in the html. I also made a little fiddle to show it working: http://jsfiddle.net/ETLZ8/",
2013-01-29T16:59:05
yy