You need to know how many pixels are rewound in a div block, counting from its bottom. If scrolling is squandered to the very end, should output 0.
I try to play with these parameters, but it does not:
var block = document.getElementById("mydiv"); alert (block.scrollTop + ' ' + block.scrollHeight);