diff --git a/assets/arena.html b/assets/arena.html index 138849d..35be8a6 100644 --- a/assets/arena.html +++ b/assets/arena.html @@ -604,10 +604,10 @@ handleScrollChatBody(event, index) { const chat = this.chats[index]; const { scrollTop, clientHeight, scrollHeight } = event.target; - if ((event.target._prevScrollTop || 0) > scrollTop) { + if ((event.target._prevScrollTop || 0) > scrollTop + 1) { chat.shouldScrollChatBodyToBottom = false; chat.isShowScrollToBottomBtn = true; - } else if (chat.isShowScrollToBottomBtn && scrollTop + clientHeight >= scrollHeight - 10) { + } else if (chat.isShowScrollToBottomBtn && scrollTop + clientHeight > scrollHeight - 5) { chat.isShowScrollToBottomBtn = false; } }, @@ -672,7 +672,7 @@ const $chatBody = document.querySelector('#chat-body-' + index); if ($chatBody) { const { scrollTop, scrollHeight, clientHeight } = $chatBody; - if (scrollTop + clientHeight < scrollHeight - 10) { + if (scrollTop + clientHeight < scrollHeight - 5) { $chatBody.scrollTop = scrollHeight; $chatBody._prevScrollTop = $chatBody.scrollTop; } diff --git a/assets/playground.html b/assets/playground.html index af675fd..56f84eb 100644 --- a/assets/playground.html +++ b/assets/playground.html @@ -760,10 +760,10 @@ handleScrollChatBody(event) { const { scrollTop, clientHeight, scrollHeight } = event.target; - if ((event.target._prevScrollTop || 0) > scrollTop) { + if ((event.target._prevScrollTop || 0) > scrollTop + 1) { this.shouldScrollChatBodyToBottom = false; this.isShowScrollToBottomBtn = true; - } else if (this.isShowScrollToBottomBtn && scrollTop + clientHeight >= scrollHeight - 10) { + } else if (this.isShowScrollToBottomBtn && scrollTop + clientHeight > scrollHeight - 5) { this.isShowScrollToBottomBtn = false; } }, @@ -829,7 +829,7 @@ const $chatBody = this.$refs["chat-body"]; if ($chatBody) { const { scrollTop, scrollHeight, clientHeight } = $chatBody; - if (scrollTop + clientHeight < scrollHeight - 10) { + if (scrollTop + clientHeight < scrollHeight - 5) { $chatBody.scrollTop = scrollHeight; $chatBody._prevScrollTop = $chatBody.scrollTop; }