Update pages/home.py
Browse files- pages/home.py +23 -10
pages/home.py
CHANGED
@@ -48,18 +48,31 @@ st.header("Tags the below 41 medical entities")
|
|
48 |
'VOLUME'
|
49 |
'WEIGHT'
|
50 |
|
|
|
|
|
|
|
51 |
|
52 |
# Create scrollable content
|
53 |
for i in range(100):
|
54 |
st.write(f"This is scrollable content line {i}")
|
55 |
|
56 |
-
# Add
|
57 |
-
st.
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
'VOLUME'
|
49 |
'WEIGHT'
|
50 |
|
51 |
+
# --- Automatic Scrolling Approach ---
|
52 |
+
# Add a checkbox to control auto-scrolling
|
53 |
+
auto_scroll = st.sidebar.checkbox("Auto-scroll to bottom", value=True)
|
54 |
|
55 |
# Create scrollable content
|
56 |
for i in range(100):
|
57 |
st.write(f"This is scrollable content line {i}")
|
58 |
|
59 |
+
# Add a manual scroll button at both top and bottom for convenience
|
60 |
+
if st.button("Scroll to Bottom") or auto_scroll:
|
61 |
+
# Create a link target
|
62 |
+
st.markdown('''
|
63 |
+
<a name="bottom"></a>
|
64 |
+
''', unsafe_allow_html=True)
|
65 |
+
|
66 |
+
# Use Streamlit's HTML component to execute the scroll
|
67 |
+
st.components.v1.html('''
|
68 |
+
<script>
|
69 |
+
// Use the iframe parent to scroll the main content area
|
70 |
+
window.parent.document.querySelector('section.main').scrollTo({
|
71 |
+
top: window.parent.document.querySelector('section.main').scrollHeight,
|
72 |
+
behavior: 'smooth'
|
73 |
+
});
|
74 |
+
</script>
|
75 |
+
''', height=0)
|
76 |
+
|
77 |
+
# Add some text at the bottom as a visual indicator
|
78 |
+
st.write("You've reached the bottom!")
|