Update app.py
Browse files
app.py
CHANGED
@@ -1,58 +1,46 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Set page config
|
4 |
-
st.set_page_config(page_title="
|
5 |
-
|
6 |
-
#
|
7 |
-
|
8 |
-
<
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
statusWidget.style.top = '10px';
|
21 |
-
statusWidget.style.right = '10px';
|
22 |
-
statusWidget.style.zIndex = '1000000';
|
23 |
-
statusWidget.style.backgroundColor = 'white';
|
24 |
-
statusWidget.style.borderRadius = '4px';
|
25 |
-
statusWidget.style.boxShadow = '0 0 10px rgba(0,0,0,0.2)';
|
26 |
-
statusWidget.style.padding = '4px';
|
27 |
-
console.log('Status widget positioned successfully');
|
28 |
-
} else {
|
29 |
-
console.log('Status widget not found, will retry');
|
30 |
}
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
// Continue checking periodically in case the widget gets recreated
|
40 |
-
setInterval(fixStatusWidget, 2000);
|
41 |
-
</script>
|
42 |
-
"""
|
43 |
-
|
44 |
-
# Inject the JavaScript
|
45 |
-
st.components.v1.html(js_code, height=0)
|
46 |
|
47 |
# Your regular Streamlit app content
|
48 |
-
st.title("App with
|
49 |
-
st.write("Scroll down to
|
50 |
|
51 |
-
# Generate content for scrolling
|
52 |
for i in range(30):
|
53 |
st.write(f"Testing content line {i}")
|
54 |
-
if i %
|
55 |
-
st.markdown("
|
56 |
|
57 |
# --- SHARED ON ALL PAGES ---
|
58 |
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Set page config
|
4 |
+
st.set_page_config(page_title="Fixed Top Toolbar", layout="wide")
|
5 |
+
|
6 |
+
# CSS to fix the entire top toolbar
|
7 |
+
st.markdown("""
|
8 |
+
<style>
|
9 |
+
/* Target the entire header/toolbar section */
|
10 |
+
header[data-testid="stHeader"],
|
11 |
+
header.css-18ni7ap.e8zbici2,
|
12 |
+
.stApp > header {
|
13 |
+
position: fixed !important;
|
14 |
+
top: 0 !important;
|
15 |
+
left: 0 !important;
|
16 |
+
right: 0 !important;
|
17 |
+
height: auto !important;
|
18 |
+
z-index: 999999 !important;
|
19 |
+
background-color: white !important;
|
20 |
+
box-shadow: 0 1px 5px rgba(0,0,0,0.1) !important;
|
21 |
+
}
|
22 |
|
23 |
+
/* Add padding to main content to prevent it being hidden under fixed header */
|
24 |
+
.main .block-container {
|
25 |
+
padding-top: 3rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
+
|
28 |
+
/* Make sure status widget appears above other elements */
|
29 |
+
[data-testid="stStatusWidget"] {
|
30 |
+
z-index: 1000000 !important;
|
31 |
+
}
|
32 |
+
</style>
|
33 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
# Your regular Streamlit app content
|
36 |
+
st.title("App with Fixed Top Toolbar")
|
37 |
+
st.write("Scroll down to test if the toolbar and status widget stay fixed")
|
38 |
|
39 |
+
# Generate content for scrolling
|
40 |
for i in range(30):
|
41 |
st.write(f"Testing content line {i}")
|
42 |
+
if i % 5 == 0:
|
43 |
+
st.markdown("---")
|
44 |
|
45 |
# --- SHARED ON ALL PAGES ---
|
46 |
st.logo(image="images/menu_book_60dp_75FBFD.png")
|