You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
770 B
JavaScript
23 lines
770 B
JavaScript
|
|
const openChatButton = document.getElementById('openChatContainer');
|
|
const chatContainer = document.getElementById('chatContainer');
|
|
const closeChatButton = document.getElementById('closeChatContainer');
|
|
|
|
|
|
const conversation = document.getElementById('conversation');
|
|
function scrollToBottom() {
|
|
conversation.scrollTop = conversation.scrollHeight;
|
|
}
|
|
|
|
openChatButton.addEventListener('click', function () {
|
|
chatContainer.classList.remove('hidden');
|
|
openChatButton.classList.add('hidden');
|
|
closeChatButton.classList.remove('hidden');
|
|
scrollToBottom();
|
|
});
|
|
|
|
closeChatButton.addEventListener('click', function () {
|
|
chatContainer.classList.add('hidden');
|
|
openChatButton.classList.remove('hidden');
|
|
closeChatButton.classList.add('hidden');
|
|
}); |