fix scroll to element
Browse files
app.py
CHANGED
@@ -229,6 +229,12 @@ with gr.Blocks(theme=theme,css = "@media (max-width: 600px) {" +
|
|
229 |
"<div><h1 style='font-size: 30px; line-height: 24px; margin-left: 50px;'>Not a bop....</h1></div>")
|
230 |
|
231 |
song_dropdown.change(fn=update_features, inputs=[song_dropdown,track_ids_var], outputs=inputs)
|
232 |
-
predict_button.click(fn=predict_popularity, inputs=inputs, outputs=popularity_box, scroll_to_output=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
demo.launch()
|
|
|
229 |
"<div><h1 style='font-size: 30px; line-height: 24px; margin-left: 50px;'>Not a bop....</h1></div>")
|
230 |
|
231 |
song_dropdown.change(fn=update_features, inputs=[song_dropdown,track_ids_var], outputs=inputs)
|
232 |
+
predict_button.click(fn=predict_popularity, inputs=inputs, outputs=popularity_box, scroll_to_output=True,
|
233 |
+
_js="const element = document.querySelector('output');"+
|
234 |
+
"const rect = element.getBoundingClientRect();"+
|
235 |
+
"const options = {left: rect.left, top: rect.top, behavior: 'smooth'}"+
|
236 |
+
"parentIFrame' in window ?"
|
237 |
+
"window.parentIFrame.scrollTo(options):"+
|
238 |
+
"window.scrollTo(options)")
|
239 |
|
240 |
demo.launch()
|