diff --git a/public/script.js b/public/script.js index bbce39cac..d147f0d02 100644 --- a/public/script.js +++ b/public/script.js @@ -2136,11 +2136,12 @@ export function appendMediaToMessage(mes, messageElement, scrollBehavior = SCROL chatElement.scrollTop(scrollPosition); return; } - const newChatHeight = chatElement.prop('scrollHeight'); - const diff = newChatHeight - chatHeight; - if (Math.abs(diff) < 1) { + const newScrollPosition = chatElement.scrollTop(); + if (newScrollPosition > scrollPosition) { return; } + const newChatHeight = chatElement.prop('scrollHeight'); + const diff = newChatHeight - chatHeight; chatElement.scrollTop(scrollPosition + diff); };