diff --git a/www/js/ui.js b/www/js/ui.js index 38f57e3c..9b6aff0a 100644 --- a/www/js/ui.js +++ b/www/js/ui.js @@ -90,7 +90,13 @@ $("#messagebuffer").scroll(function (ev) { } 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) { SCROLLCHAT = true; $("#newmessages-indicator").remove();