Add buffer zone to consider scrolling 'caught up'
This commit is contained in:
parent
b0d5e92350
commit
889fb6595f
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue