Skip to content

Commit

Permalink
Evaluate live chat scroll check on scrollend
Browse files Browse the repository at this point in the history
  • Loading branch information
kommunarr committed Jun 21, 2024
1 parent f40876c commit 469b914
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,16 @@ export default defineComponent({
}
},

onScroll: function (event) {
onScroll: function (event, isScrollEnd = false) {
const liveChatComments = this.$refs.liveChatComments
if (event.wheelDelta >= 0 && this.stayAtBottom) {
this.stayAtBottom = false

if (liveChatComments.scrollHeight > liveChatComments.clientHeight) {
this.showScrollToBottom = true
}
} else if (event.wheelDelta < 0 && !this.stayAtBottom) {
if ((liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) {
this.scrollToBottom()
}
} else if ((isScrollEnd || event.wheelDelta < 0) && !this.stayAtBottom && (liveChatComments.scrollHeight - liveChatComments.scrollTop) === liveChatComments.clientHeight) {
this.scrollToBottom()
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
class="liveChatComments"
:style="{ blockSize: chatHeight }"
@mousewheel="e => onScroll(e)"
@scrollend="e => onScroll(e, true)"
>
<div
v-for="(comment, index) in comments"
Expand Down

0 comments on commit 469b914

Please sign in to comment.