add scrolling to the chat, chat should automatically scroll to the newest message - Follow Up Deployment
Browse files- index.html +22 -16
index.html
CHANGED
@@ -90,7 +90,7 @@
|
|
90 |
<p class="text-gray-400">Your personal technical sales assistant</p>
|
91 |
</div>
|
92 |
|
93 |
-
<div id="chat-container" class="flex-1 glass-effect rounded-2xl p-4 overflow-y-auto mb-4">
|
94 |
<div id="chat-messages" class="space-y-4">
|
95 |
<!-- Messages will appear here -->
|
96 |
</div>
|
@@ -255,22 +255,26 @@
|
|
255 |
messageDiv.appendChild(messageBubble);
|
256 |
chatMessages.appendChild(messageDiv);
|
257 |
|
258 |
-
//
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
|
|
263 |
|
264 |
return messageBubble;
|
265 |
}
|
266 |
|
267 |
function simulateTyping(text, element, delay, callback) {
|
268 |
element.textContent = text;
|
269 |
-
//
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
|
|
|
|
274 |
if (callback) callback();
|
275 |
}
|
276 |
|
@@ -301,11 +305,13 @@
|
|
301 |
messageDiv.appendChild(galleryBubble);
|
302 |
chatMessages.appendChild(messageDiv);
|
303 |
|
304 |
-
//
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
309 |
}
|
310 |
|
311 |
function playNextMessage() {
|
|
|
90 |
<p class="text-gray-400">Your personal technical sales assistant</p>
|
91 |
</div>
|
92 |
|
93 |
+
<div id="chat-container" class="flex-1 glass-effect rounded-2xl p-4 overflow-y-auto mb-4" style="scroll-behavior: smooth;">
|
94 |
<div id="chat-messages" class="space-y-4">
|
95 |
<!-- Messages will appear here -->
|
96 |
</div>
|
|
|
255 |
messageDiv.appendChild(messageBubble);
|
256 |
chatMessages.appendChild(messageDiv);
|
257 |
|
258 |
+
// Scroll to bottom with smooth behavior
|
259 |
+
setTimeout(() => {
|
260 |
+
chatMessages.scrollTo({
|
261 |
+
top: chatMessages.scrollHeight,
|
262 |
+
behavior: 'smooth'
|
263 |
+
});
|
264 |
+
}, 10);
|
265 |
|
266 |
return messageBubble;
|
267 |
}
|
268 |
|
269 |
function simulateTyping(text, element, delay, callback) {
|
270 |
element.textContent = text;
|
271 |
+
// Scroll to bottom with smooth behavior
|
272 |
+
setTimeout(() => {
|
273 |
+
chatMessages.scrollTo({
|
274 |
+
top: chatMessages.scrollHeight,
|
275 |
+
behavior: 'smooth'
|
276 |
+
});
|
277 |
+
}, 10);
|
278 |
if (callback) callback();
|
279 |
}
|
280 |
|
|
|
305 |
messageDiv.appendChild(galleryBubble);
|
306 |
chatMessages.appendChild(messageDiv);
|
307 |
|
308 |
+
// Scroll to bottom with smooth behavior
|
309 |
+
setTimeout(() => {
|
310 |
+
chatMessages.scrollTo({
|
311 |
+
top: chatMessages.scrollHeight,
|
312 |
+
behavior: 'smooth'
|
313 |
+
});
|
314 |
+
}, 10);
|
315 |
}
|
316 |
|
317 |
function playNextMessage() {
|