[英]Mathquill Having No Effect
我正在嘗試使用 Mathquill 進行一些簡單的 static 格式化。 當我測試我的代碼時,文本沒有被格式化,也沒有任何錯誤讓我知道我是否做錯了什么。
<html>
<head>
<style>
<link rel="stylesheet" href="dist/mathquill/mathquill.css"/>
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="dist/mathquill/mathquill.js"></script>
<script>
var MQ = MathQuill.getInterface(2);
var problemSpan = document.getElementById('problem');
MQ.StaticMath(problemSpan);
</script>
</head>
<body>
<p>Solve <span id="problem">ax^2 + bx + c = 0</span>.</p>
</body>
</html>
所有路徑都是正確的,因為沒有 404 錯誤。
不需要樣式標簽,並且會干擾鏈接標簽。 需要等待 DOM 准備好。
<html> <head> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mathquill/0.10.1/mathquill.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathquill/0.10.1/mathquill.js"></script> <script> window.addEventListener('DOMContentLoaded', () => { var MQ = MathQuill.getInterface(2); var problemSpan = document.getElementById('problem'); MQ.StaticMath(problemSpan); }); </script> </head> <body> <p>Solve <span id="problem">ax^2 + bx + c = 0</span>.</p> </body> </html>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.