Skip to content

Commit c7e69fc

Browse files
Fixed Mathjax script run before p5 loads elements
1 parent 021765e commit c7e69fc

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

pages/equations.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" type="text/css" href="../style.css">
1010
<link rel="stylesheet" type="text/css" href="equations.css">
1111
<link rel="icon" type="image/x-icon" href="../assets/ico/favicon.ico">
12+
<!-- MathJax-script loaded dynamically by equations.js -->
1213
</head>
1314

1415
<body>

pages/equations.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ function setup() {
6363
cards[i].append(title, innerContainer);
6464
}
6565
}
66-
}
6766

68-
// load MathJax after all
69-
let mathjax = document.createElement('script');
70-
mathjax.id = "MathJax-script";
71-
mathjax.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
72-
mathjaxsetAttribute('async', '');
73-
document.head.appendChild(mathjax);
67+
// load MathJax after all
68+
let mathjax = document.createElement('script');
69+
mathjax.id = "MathJax-script";
70+
mathjax.src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
71+
mathjax.defer = true;
72+
document.head.appendChild(mathjax);
73+
}

0 commit comments

Comments
 (0)