Update app.py
Browse files
app.py
CHANGED
@@ -31,36 +31,6 @@ about_page = st.Page(
|
|
31 |
icon=":material/info:",
|
32 |
default=False)
|
33 |
|
34 |
-
# --- Automatic Scrolling Approach ---
|
35 |
-
# Add a checkbox to control auto-scrolling
|
36 |
-
auto_scroll = st.sidebar.checkbox("Auto-scroll to bottom", value=True)
|
37 |
-
|
38 |
-
# Create scrollable content
|
39 |
-
for i in range(100):
|
40 |
-
st.write(f"This is scrollable content line {i}")
|
41 |
-
|
42 |
-
# Add a manual scroll button at both top and bottom for convenience
|
43 |
-
if st.button("Scroll to Bottom") or auto_scroll:
|
44 |
-
# Create a link target
|
45 |
-
st.markdown('''
|
46 |
-
<a name="bottom"></a>
|
47 |
-
''', unsafe_allow_html=True)
|
48 |
-
|
49 |
-
# Use Streamlit's HTML component to execute the scroll
|
50 |
-
st.components.v1.html('''
|
51 |
-
<script>
|
52 |
-
// Use the iframe parent to scroll the main content area
|
53 |
-
window.parent.document.querySelector('section.main').scrollTo({
|
54 |
-
top: window.parent.document.querySelector('section.main').scrollHeight,
|
55 |
-
behavior: 'smooth'
|
56 |
-
});
|
57 |
-
</script>
|
58 |
-
''', height=0)
|
59 |
-
|
60 |
-
# Add some text at the bottom as a visual indicator
|
61 |
-
st.write("You've reached the bottom!")
|
62 |
-
|
63 |
-
|
64 |
# --- NAVIGATION SETUP ---
|
65 |
#pg = st.navigation(pages=[home_page, type_text_page, upload_file_page, about_page]) # WITHOUT SECTIONS
|
66 |
pg = st.navigation({"Home": [home_page], "Demo": [type_text_page, upload_file_page], "About": [about_page]}) # WITH SECTIONS
|
|
|
31 |
icon=":material/info:",
|
32 |
default=False)
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# --- NAVIGATION SETUP ---
|
35 |
#pg = st.navigation(pages=[home_page, type_text_page, upload_file_page, about_page]) # WITHOUT SECTIONS
|
36 |
pg = st.navigation({"Home": [home_page], "Demo": [type_text_page, upload_file_page], "About": [about_page]}) # WITH SECTIONS
|