mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-10 18:52:55 +02:00
feat: Add scroll-to-bottom button in DM view
Reuses the same CSS styling as channel chat button. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -119,6 +119,25 @@ function setupEventListeners() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Scroll-to-bottom button
|
||||
const messagesContainer = document.getElementById('dmMessagesContainer');
|
||||
const scrollToBottomBtn = document.getElementById('dmScrollToBottomBtn');
|
||||
if (messagesContainer && scrollToBottomBtn) {
|
||||
messagesContainer.addEventListener('scroll', function() {
|
||||
const isAtBottom = messagesContainer.scrollHeight - messagesContainer.scrollTop <= messagesContainer.clientHeight + 100;
|
||||
if (isAtBottom) {
|
||||
scrollToBottomBtn.classList.remove('visible');
|
||||
} else {
|
||||
scrollToBottomBtn.classList.add('visible');
|
||||
}
|
||||
});
|
||||
|
||||
scrollToBottomBtn.addEventListener('click', function() {
|
||||
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
||||
scrollToBottomBtn.classList.remove('visible');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user