kcelia commited on
Commit
f4be312
1 Parent(s): a548688

chore: another attemp

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -538,18 +538,23 @@ CSS = """
538
  """
539
  back_to_top_btn_html = '''
540
 
541
- <script>
542
- const element = document.getElementById("content");
 
543
 
 
544
  function scrollToTop() {
545
- element.scrollIntoView(true);
546
- }
547
-
548
- function scrollToBottom() {
549
- element.scrollIntoView(false);
 
 
550
  }
551
  </script>
552
 
 
553
  '''
554
 
555
  if __name__ == "__main__":
 
538
  """
539
  back_to_top_btn_html = '''
540
 
541
+ <button onclick="scrollToTop()" style="color:white; text-decoration:none;">
542
+ Back to Top!
543
+ </button>
544
 
545
+ <script>
546
  function scrollToTop() {
547
+ // Check if the parentIFrame exists and use it for scrolling if available
548
+ if ('parentIFrame' in window) {
549
+ window.parentIFrame.scrollTo({top: 0, behavior: 'smooth'});
550
+ } else {
551
+ // Use the standard scrollIntoView method for scrolling
552
+ document.documentElement.scrollIntoView({behavior: 'smooth'});
553
+ }
554
  }
555
  </script>
556
 
557
+
558
  '''
559
 
560
  if __name__ == "__main__":