Scrolling via Javascript not possible

Hi everyone,
i am looking for a way to scroll through my application. From my understanding you need to use markdown with javascript.
I have this function that I thought would do the job def auto_scroll_down(amount_px: int): scroll_script = f""" <script> function scrollDown() {{ window.scrollBy({{ top: {amount_px}, left: 0, behavior: 'smooth' }}); }} scrollDown(); </script> """ st.markdown(scroll_script, unsafe_allow_html=True)

but for some reason the nothing happens when i call this function. Can someone help maybe?
Thanks in advance

st.markdown does not run javascript code. st.components.v1.html does, but that will be contained to its own iframe. Check question 3 in this blog post for a better explanation:

Thank you for the heads-up. Too bad it doesnt work

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.