0
In the code below, the alert is triggered when the scroll arrives at the end.
$('#messages').scroll(function() {
if ($(this).scrollTop() + $(this).height() == $(this).get(0).scrollHeight) {
alert('a rolagem chegou ao fim, fazer algo aqui.');
}
});
However, when loading the page, the scroll starts at the bottom.
How can I do the reverse of the above code, and alert when the scroll reaches the top?