I need a way to automatically find the maximum bottom value of scrollTop, of the div id \"#box\".
Something like this: How to get maximum document scrolltop value
In vanilla JS:
var maxScrollTop = el.scrollHeight - el.offsetHeight
look here a complete answer:
https://stackoverflow.com/a/48246003/7668448
What about using that with jquery:
var max = $('#element')[0].scrollLeftMax; // when using the polyfill
var max = $('#element')[0].scrollLeftMaxi(); // when using the other alternative more support IE6+
Here's a version that accounts for padding and uses prop
instead of accessing the DOM element directly.
$('#box').prop('scrollHeight') - $('#box').innerHeight();
here you go:
var trueDivHeight = $('.someclass')[0].scrollHeight;
var divHeight = $('.someclass').height();
var scrollLeft = trueDivHeight - divHeight;
alert(scrollLeft);
Simplified