gpt4 book ai didi

javascript - 为什么 mathjax 不能在包含 jquery html 的 switch case 中工作

转载 作者:行者123 更新时间:2023-12-01 01:55:48 25 4
gpt4 key购买 nike

我使用 mathjax 并包含 html,当我使用它时,mathjax 不起作用,但没有 switch case 它工作正常,为什么?
JS

function change() {
var x=Math.floor(Math.random() * 5);

switch(x) {
case 0:
$(function(){
$("#erwtisi").load("test.html");
});
break;
case 1:
$(function(){
$("#erwtisi").load("test.html");
});
break;
.............etc

最佳答案

您正在 MathJax 解析并排版页面上的数据后加载内容。按照文档中的详细说明对另一个 MathJax 渲染进行排队:Modifying Math on the Page .

If you are writing a dynamic web page where content containing mathematics may appear after MathJax has already typeset the rest of the page, then you will need to tell MathJax to look for mathematics in the page again when that new content is produced. To do that, you need to use the MathJax.Hub.Typeset() method. This will cause the preprocessors (if any were loaded) to run over the page again, and then MathJax will look for unprocessed mathematics on the page and typeset it, leaving unchanged any math that has already been typeset.

建议使用它来排队:

MathJax.Hub.Queue(["Typeset",MathJax.Hub]);

关于javascript - 为什么 mathjax 不能在包含 jquery html 的 switch case 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51049656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com