var modal_scrollTop = $('.modal-body').scrollTop();
var modal_scrollHeight = $('.modal-body').prop('scrollHeight');
var modal_innerHeight = $('.modal-body').innerHeight();
$('.modal-body').scroll(function() {
// Write to console log to debug:
console.warn('modal_scrollTop: ' + modal_scrollTop);
console.warn('modal_innerHeight: ' + modal_innerHeight);
console.warn('modal_scrollHeight: ' + modal_scrollHeight);
// Bottom reached:
if (modal_scrollTop + modal_innerHeight >= (modal_scrollHeight - 100)) {
alert('reached bottom');
}
});