MathJax with jQuery Show — Right Way
<html>
<head>
<title>MathJax with jQuery Show — Right Way</title>
<script
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<script src="jquery-1.8.3.min.js"></script>
</head>
<body>
<div id="eq" style="border:1px solid; padding:10px 20px; margin:0 auto; width:22em">
Press "Update" to get math here.
</div>
<p><input type="button" value="Update" onclick="DynamicMJ.update()" /></p>
<script>
var DynamicMJ = {
n: 0,
update: function () {
this.n++; if (this.n > 3) {this.n = 1}
var eq = $("#eq");
eq.css("visibility","hidden");
eq.load("math-"+this.n+".html",function () {
MathJax.Hub.Queue(
["Typeset",MathJax.Hub,"eq"],
["hide",eq],
["css",eq,"visibility","visible"],
["show",eq,"slow"]
);
})
}
};
</script>
</body>
</html>
|