Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -287,11 +287,17 @@ button {
|
|
| 287 |
"""
|
| 288 |
scroll_to_top_js = """
|
| 289 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
document.addEventListener('DOMContentLoaded', function () {
|
| 291 |
-
const
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
}
|
| 295 |
});
|
| 296 |
</script>
|
| 297 |
"""
|
|
|
|
| 287 |
"""
|
| 288 |
scroll_to_top_js = """
|
| 289 |
<script>
|
| 290 |
+
// Function to scroll to the top of the page when navigating
|
| 291 |
+
function scrollToTop() {
|
| 292 |
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
// Attach scroll-to-top functionality to buttons dynamically
|
| 296 |
document.addEventListener('DOMContentLoaded', function () {
|
| 297 |
+
const viewCartButton = document.querySelector('button[gr-id="view_cart_button"]');
|
| 298 |
+
if (viewCartButton) {
|
| 299 |
+
viewCartButton.addEventListener('click', scrollToTop);
|
| 300 |
+
}
|
| 301 |
});
|
| 302 |
</script>
|
| 303 |
"""
|