首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mathquill没有效果

Mathquill没有效果
EN

Stack Overflow用户
提问于 2020-05-12 00:08:07
回答 1查看 56关注 0票数 0

我正在尝试用Mathquill做一些简单的静态格式化。当我测试我的代码时,文本没有格式化,也没有任何错误让我知道我是否做错了什么。

代码语言:javascript
复制
<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错误。

EN

回答 1

Stack Overflow用户

发布于 2020-05-12 00:41:49

不需要样式标签,并且会干扰链接标签。需要等待DOM就绪。

代码语言:javascript
复制
<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>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61734179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档