nagasurendra commited on
Commit
cb06849
·
verified ·
1 Parent(s): 8b2439a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -320,6 +320,20 @@ button {
320
  observer.observe(document.body, { childList: true, subtree: true });
321
  });
322
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
 
324
 
325
  """
 
320
  observer.observe(document.body, { childList: true, subtree: true });
321
  });
322
  </script>
323
+ <script>
324
+ document.addEventListener("DOMContentLoaded", function () {
325
+ // Attach a global listener to all button clicks
326
+ document.body.addEventListener("click", function (event) {
327
+ const clickedButton = event.target;
328
+ if (clickedButton.innerText === "View Cart") {
329
+ // Wait a short delay to allow Gradio transition, then scroll to top
330
+ setTimeout(() => {
331
+ window.scrollTo({ top: 0, behavior: "smooth" });
332
+ }, 100);
333
+ }
334
+ });
335
+ });
336
+ </script>
337
 
338
 
339
  """