michalkichal commited on
Commit
5f5110d
·
verified ·
1 Parent(s): 9dd67cc

add scrolling to the chat, chat should automatically scroll to the newest message - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. 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
- // Smooth scroll to bottom
259
- chatMessages.scrollTo({
260
- top: chatMessages.scrollHeight,
261
- behavior: 'smooth'
262
- });
 
 
263
 
264
  return messageBubble;
265
  }
266
 
267
  function simulateTyping(text, element, delay, callback) {
268
  element.textContent = text;
269
- // Smooth scroll to bottom
270
- chatMessages.scrollTo({
271
- top: chatMessages.scrollHeight,
272
- behavior: 'smooth'
273
- });
 
 
274
  if (callback) callback();
275
  }
276
 
@@ -301,11 +305,13 @@
301
  messageDiv.appendChild(galleryBubble);
302
  chatMessages.appendChild(messageDiv);
303
 
304
- // Smooth scroll to bottom
305
- chatMessages.scrollTo({
306
- top: chatMessages.scrollHeight,
307
- behavior: 'smooth'
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() {