Saturday, June 1, 2024
 Popular · Latest · Hot · Upcoming
26
rated 0 times [  27] [ 1]  / answers: 1 / hits: 61289  / 13 Years ago, fri, april 29, 2011, 12:00:00

I have a div with overflow:scroll.



I want to know if it's currently scrolled all the way down. How, using JQuery?



This one doesn't work: How can I determine if a div is scrolled to the bottom?


More From » jquery

 Answers
126

Here is the correct solution (jsfiddle). A brief look at the code:



$(document).ready(function () {
$('div').on('scroll', chk_scroll);
});

function chk_scroll(e) {
var elem = $(e.currentTarget);
if (elem[0].scrollHeight - elem.scrollTop() == elem.outerHeight()) {
console.log(bottom);
}
}


See this for more info.


[#92492] Wednesday, April 27, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gageherberth

Total Points: 249
Total Questions: 115
Total Answers: 119

Location: Liechtenstein
Member since Sun, Sep 12, 2021
3 Years ago
;