| 2136 | chatElement.scrollTop(scrollPosition); | 2136 | chatElement.scrollTop(scrollPosition); |
| 2137 | return; | 2137 | return; |
| 2138 | } | 2138 | } |
| 2139 | const newChatHeight = chatElement.prop('scrollHeight'); | 2139 | const newScrollPosition = chatElement.scrollTop(); |
| 2140 | const diff = newChatHeight - chatHeight; | 2140 | if (newScrollPosition > scrollPosition) { |
| 2141 | if (Math.abs(diff) < 1) { | | |
| 2142 | return; | 2141 | return; |
| 2143 | } | 2142 | } |
| | 2143 | const newChatHeight = chatElement.prop('scrollHeight'); |
| | 2144 | const diff = newChatHeight - chatHeight; |
| 2144 | chatElement.scrollTop(scrollPosition + diff); | 2145 | chatElement.scrollTop(scrollPosition + diff); |
| 2145 | }; | 2146 | }; |
| 2146 | | 2147 | |