Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -320,7 +320,7 @@ def app():
|
|
| 320 |
with gr.Blocks() as demo:
|
| 321 |
scroll_js = """
|
| 322 |
<script>
|
| 323 |
-
function
|
| 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)
|
| 456 |
-
outputs=[menu_section, cart_section
|
| 457 |
)
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
# Bottom View Cart Button
|
| 461 |
view_cart_button_bottom.click(
|
| 462 |
-
lambda: (gr.update(visible=False), gr.update(visible=True)
|
| 463 |
-
outputs=[menu_section, cart_section
|
| 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 |
|