georad commited on
Commit
5c7db51
·
verified ·
1 Parent(s): 645f459

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -16
app.py CHANGED
@@ -31,23 +31,24 @@ about_page = st.Page(
31
  icon=":material/info:",
32
  default=False)
33
 
34
- # This is the key trick:
35
- # 1. Define all content first
36
- content = [f"This is scrollable content line {i}" for i in range(100)]
37
 
38
- # 2. Display first part of content
39
- for i in range(len(content) - 1):
40
- st.write(content[i])
41
-
42
- # 3. Add a placeholder for the last item
43
- last_item = st.empty()
44
-
45
- # 4. Show "Bottom Reached!" message to confirm we're at the bottom
46
- st.success("Bottom of page reached!")
47
-
48
- # 5. Finally, add the last content item
49
- # This forces Streamlit to render the page up to the bottom
50
- last_item.write(content[-1])
 
 
 
 
51
 
52
 
53
  # --- NAVIGATION SETUP ---
 
31
  icon=":material/info:",
32
  default=False)
33
 
 
 
 
34
 
35
+ # Create scrollable content
36
+ for i in range(100):
37
+ st.write(f"This is scrollable content line {i}")
38
+
39
+ # Create an anchor at the bottom
40
+ st.markdown('<div id="bottom"></div>', unsafe_allow_html=True)
41
+
42
+ # Add JavaScript to automatically scroll to the anchor
43
+ st.markdown("""
44
+ <script>
45
+ // Set a timeout to ensure the page has loaded
46
+ setTimeout(function() {
47
+ // Scroll to the bottom anchor
48
+ document.getElementById('bottom').scrollIntoView();
49
+ }, 500);
50
+ </script>
51
+ """, unsafe_allow_html=True)
52
 
53
 
54
  # --- NAVIGATION SETUP ---