Update app.py
Browse files
app.py
CHANGED
|
@@ -30,40 +30,6 @@ def add_sticky_header_css():
|
|
| 30 |
</style>
|
| 31 |
""", unsafe_allow_html=True)
|
| 32 |
|
| 33 |
-
def auto_scroll_to_bottom():
|
| 34 |
-
# JavaScript to scroll to bottom
|
| 35 |
-
js_code = """
|
| 36 |
-
<script>
|
| 37 |
-
// Wait for the page to fully render
|
| 38 |
-
const scrollToBottom = () => {
|
| 39 |
-
// Get the main Streamlit iframe
|
| 40 |
-
const streamlitDoc = window.parent.document;
|
| 41 |
-
// Get the app container
|
| 42 |
-
const appContainer = streamlitDoc.querySelector('.main');
|
| 43 |
-
if (appContainer) {
|
| 44 |
-
// Scroll the app container to the bottom
|
| 45 |
-
appContainer.scrollTop = appContainer.scrollHeight;
|
| 46 |
-
} else {
|
| 47 |
-
// Fallback to scrolling the entire page
|
| 48 |
-
window.parent.scrollTo(0, streamlitDoc.body.scrollHeight);
|
| 49 |
-
}
|
| 50 |
-
};
|
| 51 |
-
|
| 52 |
-
// Try immediately
|
| 53 |
-
scrollToBottom();
|
| 54 |
-
|
| 55 |
-
// Also try after a short delay to ensure content is rendered
|
| 56 |
-
setTimeout(scrollToBottom, 200);
|
| 57 |
-
|
| 58 |
-
// And after a longer delay just to be safe
|
| 59 |
-
setTimeout(scrollToBottom, 500);
|
| 60 |
-
</script>
|
| 61 |
-
"""
|
| 62 |
-
|
| 63 |
-
# Render the JavaScript code
|
| 64 |
-
html = f'<div style="display:none">{js_code}</div>'
|
| 65 |
-
st.components.v1.html(html, height=0)
|
| 66 |
-
|
| 67 |
# At the start of main function or execution flow
|
| 68 |
add_sticky_header_css()
|
| 69 |
|
|
|
|
| 30 |
</style>
|
| 31 |
""", unsafe_allow_html=True)
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# At the start of main function or execution flow
|
| 34 |
add_sticky_header_css()
|
| 35 |
|