From 889fb6595fde43b8e0b8b4243878c5d277cc4ce8 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sat, 5 Dec 2015 18:05:23 -0800 Subject: [PATCH] Add buffer zone to consider scrolling 'caught up' --- www/js/ui.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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();