Fanwang Meng commited on
Commit
8dc17f5
·
1 Parent(s): 0eedeb3

Proper initialization of the page layout on first load

Browse files
Files changed (1) hide show
  1. templates/index.html +42 -24
templates/index.html CHANGED
@@ -401,22 +401,33 @@
401
  }
402
  </style>
403
  <!-- MathJax Configuration -->
404
- <script type="text/x-mathjax-config">
405
  MathJax.Hub.Config({
406
  tex2jax: {
407
- inlineMath: [['$','$'], ['\\(','\\)']],
408
- displayMath: [['$$','$$'], ['\\[','\\]']],
409
- processEscapes: true,
410
- processEnvironments: true
411
- },
412
- displayAlign: 'center',
413
- "HTML-CSS": {
414
- styles: {'.MathJax_Display': {"margin": 0}},
415
- linebreaks: { automatic: true }
416
- }
417
  });
418
  </script>
 
 
 
 
 
 
 
 
419
 
 
 
 
 
 
 
 
 
 
 
420
  <!-- MathJax Loading -->
421
  <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
422
  </head>
@@ -695,20 +706,27 @@
695
  section.style.display = 'none';
696
  });
697
 
698
- // Remove active class from all nav links
699
- document.querySelectorAll('.nav-link').forEach(link => {
700
- link.classList.remove('active');
701
- });
702
-
703
  // Show selected section
704
- const section = document.getElementById(sectionId);
705
- if (section) {
706
- section.style.display = 'block';
707
- // Add active class to corresponding nav link
708
- const navLink = document.querySelector(`.nav-link[data-section="${sectionId}"]`);
709
- if (navLink) {
710
- navLink.classList.add('active');
711
- }
 
 
 
 
 
 
 
 
 
 
 
 
712
  }
713
  }
714
 
 
401
  }
402
  </style>
403
  <!-- MathJax Configuration -->
404
+ <script type="text/x-mathjax-config">
405
  MathJax.Hub.Config({
406
  tex2jax: {
407
+ inlineMath: [['$','$'], ['\\(','\\)']],
408
+ processEscapes: true
409
+ }
 
 
 
 
 
 
 
410
  });
411
  </script>
412
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML"></script>
413
+ <script>
414
+ // Initialize layout on page load
415
+ document.addEventListener('DOMContentLoaded', function() {
416
+ // Force layout recalculation
417
+ document.body.style.display = 'none';
418
+ document.body.offsetHeight; // Force reflow
419
+ document.body.style.display = '';
420
 
421
+ // Show initial section
422
+ showSection('selection');
423
+
424
+ // Update parameters for default algorithm
425
+ updateDefaultParams();
426
+
427
+ // Load markdown content
428
+ loadMarkdownContent();
429
+ });
430
+ </script>
431
  <!-- MathJax Loading -->
432
  <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
433
  </head>
 
706
  section.style.display = 'none';
707
  });
708
 
 
 
 
 
 
709
  // Show selected section
710
+ const selectedSection = document.getElementById(sectionId);
711
+ if (selectedSection) {
712
+ selectedSection.style.display = 'block';
713
+
714
+ // Force layout recalculation
715
+ selectedSection.style.opacity = '0';
716
+ selectedSection.offsetHeight; // Force reflow
717
+ selectedSection.style.opacity = '1';
718
+
719
+ // Update active nav link
720
+ document.querySelectorAll('.nav-link').forEach(link => {
721
+ link.classList.remove('active');
722
+ if (link.getAttribute('href') === '#' + sectionId) {
723
+ link.classList.add('active');
724
+ }
725
+ });
726
+
727
+ // Ensure proper scrolling
728
+ window.scrollTo(0, 0);
729
+ document.body.style.overflow = 'auto';
730
  }
731
  }
732