nagasurendra commited on
Commit
a6b12ff
·
verified ·
1 Parent(s): af86237

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -320,7 +320,7 @@ def app():
320
  with gr.Blocks() as demo:
321
  scroll_js = """
322
  <script>
323
- function scrollToTop() {
324
  window.scrollTo({top: 0, behavior: 'smooth'});
325
  }
326
  </script>
@@ -452,16 +452,14 @@ def app():
452
  # Navigate to Cart Page (Both Buttons Use the Same Logic)
453
  # Top View Cart Button
454
  view_cart_button_top.click(
455
- lambda: (gr.update(visible=False), gr.update(visible=True), "<script>scrollToTop();</script>"),
456
- outputs=[menu_section, cart_section, scroll_trigger],
457
  )
458
-
459
-
460
- # Bottom View Cart Button
461
  view_cart_button_bottom.click(
462
- lambda: (gr.update(visible=False), gr.update(visible=True), "<script>scrollToTop();</script>"),
463
- outputs=[menu_section, cart_section, scroll_trigger],
464
  )
 
465
 
466
 
467
 
 
320
  with gr.Blocks() as demo:
321
  scroll_js = """
322
  <script>
323
+ function smoothScrollToTop() {
324
  window.scrollTo({top: 0, behavior: 'smooth'});
325
  }
326
  </script>
 
452
  # Navigate to Cart Page (Both Buttons Use the Same Logic)
453
  # Top View Cart Button
454
  view_cart_button_top.click(
455
+ lambda: (gr.update(visible=False), gr.update(visible=True)),
456
+ outputs=[menu_section, cart_section],
457
  )
 
 
 
458
  view_cart_button_bottom.click(
459
+ lambda: (gr.update(visible=False), gr.update(visible=True)),
460
+ outputs=[menu_section, cart_section],
461
  )
462
+ view_cart_button_bottom.click(None, _js="smoothScrollToTop")
463
 
464
 
465