Hi!
I am building a Streamlit app, but I am strulling as after changing page, I noticed that the scroll bar does not reset to the top of the page.
Please consider my illustrative example, I have two long pages (Introduction and Conclusion), while being at the Introduction page I scrolled down to the end of the page, after that I changed to the Conclusion page, but unfortunately I was at the end of the Conclusion page instead of being on top.
import streamlit as st
def load_text_images_file(fname):
with open(fname, 'r', encoding='utf-8') as f:
readme_line = f.readlines()
readme_buffer = []
resource_files = [os.path.basename(x) for x in glob.glob(f'../docs/images/*')]
for line in readme_line:
readme_buffer.append(line)
for image in resource_files:
if image in line:
st.markdown(''.join(readme_buffer[:-1]))
st.image(f'../docs/images/{image}')
readme_buffer.clear()
return st.markdown(''.join(readme_buffer))
# Sidebar navigation
selected_page = st.sidebar.selectbox(
'Select page',
options=[
'Introduction',
'Conclusion',
])
if selected_page == 'Introduction':
load_text_images_file("../docs/Welcome.md")
elif selected_page == 'Conclusion':
load_text_images_file("../docs/Conclusion.md")
Is there a way to automatically reset the scroll bar?
Thank you very much in advance for your help.