Add buffer zone to consider scrolling 'caught up'

This commit is contained in:
calzoneman 2015-12-05 18:05:23 -08:00
parent b0d5e92350
commit 889fb6595f

View file

@ -90,7 +90,13 @@ $("#messagebuffer").scroll(function (ev) {
} }
var m = $("#messagebuffer"); var m = $("#messagebuffer");
var isCaughtUp = m.height() + m.scrollTop() >= m.prop("scrollHeight"); var lastChildHeight = 0;
var messages = m.children();
if (messages.length > 0) {
lastChildHeight = messages[messages.length - 1].clientHeight || 0;
}
var isCaughtUp = m.height() + m.scrollTop() >= m.prop("scrollHeight") - lastChildHeight;
if (isCaughtUp) { if (isCaughtUp) {
SCROLLCHAT = true; SCROLLCHAT = true;
$("#newmessages-indicator").remove(); $("#newmessages-indicator").remove();