Spaces:
Running
Running
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import panel as pn
|
| 2 |
-
from bokeh.models import CustomJS
|
| 3 |
|
| 4 |
import pytz
|
| 5 |
from datetime import date
|
|
@@ -127,53 +126,5 @@ template = pn.template.FastListTemplate(
|
|
| 127 |
sidebar_width=150
|
| 128 |
)
|
| 129 |
|
| 130 |
-
pn.extension()
|
| 131 |
-
|
| 132 |
-
# CSS style for the "Back to Top" button
|
| 133 |
-
css = """
|
| 134 |
-
<style>
|
| 135 |
-
.back-to-top {
|
| 136 |
-
display: none;
|
| 137 |
-
position: fixed;
|
| 138 |
-
bottom: 20px;
|
| 139 |
-
left: 20px;
|
| 140 |
-
width: 40px;
|
| 141 |
-
height: 40px;
|
| 142 |
-
border-radius: 50%;
|
| 143 |
-
background-color: #88d8b0;
|
| 144 |
-
color: white;
|
| 145 |
-
font-size: 24px;
|
| 146 |
-
text-align: center;
|
| 147 |
-
line-height: 40px;
|
| 148 |
-
cursor: pointer;
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
.back-to-top.show {
|
| 152 |
-
display: block;
|
| 153 |
-
}
|
| 154 |
-
</style>
|
| 155 |
-
"""
|
| 156 |
-
|
| 157 |
-
# Create the "Back to Top" button
|
| 158 |
-
back_to_top_button = pn.widgets.Button(name="^", button_type="primary", css_classes=["back-to-top"], width=40, height=40)
|
| 159 |
-
|
| 160 |
-
# JavaScript callback for the "Back to Top" button
|
| 161 |
-
js_code = """
|
| 162 |
-
const scrollDuration = 300;
|
| 163 |
-
const scrollStep = -window.scrollY / (scrollDuration / 15);
|
| 164 |
-
const scrollInterval = setInterval(function() {
|
| 165 |
-
if (window.scrollY !== 0) {
|
| 166 |
-
window.scrollBy(0, scrollStep);
|
| 167 |
-
} else {
|
| 168 |
-
clearInterval(scrollInterval);
|
| 169 |
-
}
|
| 170 |
-
}, 15);
|
| 171 |
-
"""
|
| 172 |
-
|
| 173 |
-
back_to_top_button.js_on_click(CustomJS(code=js_code))
|
| 174 |
-
|
| 175 |
-
# Add the "Back to Top" button to the sidebar of the template
|
| 176 |
-
template.sidebar.append(back_to_top_button)
|
| 177 |
-
|
| 178 |
# Run the app
|
| 179 |
template.servable()
|
|
|
|
| 1 |
import panel as pn
|
|
|
|
| 2 |
|
| 3 |
import pytz
|
| 4 |
from datetime import date
|
|
|
|
| 126 |
sidebar_width=150
|
| 127 |
)
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
# Run the app
|
| 130 |
template.servable()
|