Skip to content

Commit

Permalink
only auto scroll if video is playing
Browse files Browse the repository at this point in the history
  • Loading branch information
colobas committed Feb 7, 2024
1 parent 1ed7a01 commit 9d735da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Debate.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
const messageElements = chatContainer.querySelectorAll('.message');
const currentMessageElement = messageElements[lastPastMessageIndex];
if (currentMessageElement) {
// if video is playing, auto scroll to the current message
if (currentMessageElement && !video.paused) {
chatContainer.scrollTop = currentMessageElement.offsetTop - chatContainer.offsetTop - 20; // Adjust 20px offset if needed
}
});
Expand Down

0 comments on commit 9d735da

Please sign in to comment.