JacksonMu commited on
Commit
0c1b884
1 Parent(s): f32356e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -55,20 +55,20 @@ st.set_page_config(
55
  initial_sidebar_state="expanded" # Keep sidebar expanded by default
56
  )
57
 
58
- # CSS styles to prevent sidebar scrolling
59
- prevent_sidebar_scroll_css = """
60
- <style>
61
- /* Prevent sidebar scrolling */
62
- .sidebar .sidebar-content {
63
- position: fixed !important;
64
- overflow-y: auto;
65
- height: calc(100vh - 40px); /* Adjust height as needed */
66
- }
67
- </style>
68
  """
69
 
70
- # Apply the CSS styles
71
- st.markdown(prevent_sidebar_scroll_css, unsafe_allow_html=True)
72
 
73
  # CSS styles for light and dark modes
74
  universal_text_color_css = """
 
55
  initial_sidebar_state="expanded" # Keep sidebar expanded by default
56
  )
57
 
58
+ # JavaScript to prevent scrolling in the sidebar but allow scrolling within
59
+ prevent_sidebar_scroll_js = """
60
+ <script>
61
+ document.addEventListener('DOMContentLoaded', function() {
62
+ const sidebarContent = document.querySelector('.sidebar .sidebar-content');
63
+ sidebarContent.style.position = 'sticky';
64
+ sidebarContent.style.top = '0';
65
+ sidebarContent.style.overflowY = 'auto';
66
+ });
67
+ </script>
68
  """
69
 
70
+ # Apply the JavaScript
71
+ st.markdown(prevent_sidebar_scroll_js, unsafe_allow_html=True)
72
 
73
  # CSS styles for light and dark modes
74
  universal_text_color_css = """