Spaces:
Sleeping
Sleeping
File size: 476 Bytes
9e33a36 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | function scrollChat() {
const chat = document.querySelector('#chatbot .wrap');
if (!chat) return;
chat.scrollTop = chat.scrollHeight;
}
document.addEventListener("DOMContentLoaded", () => {
const target = document.querySelector('#chatbot');
if (!target) return;
const observer = new MutationObserver(() => {
scrollChat();
});
observer.observe(target, {
childList: true,
subtree: true
});
}); |