Question

I'm developing an online exam application.The questions contain just text or equations or both text and equations. The equations are displayed using Mathjax.There is a timer on the page. I want to start the timer only when the Mathjax equations are loaded completely.If the question doesn't contains any equation then the timer has to be started without waiting for Mathjax.How can this be done? The application is developed in PHP.

Was it helpful?

Solution

You don't say if you are loading MathJax on every page, or just on the ones that include Math. If on all pages, then add

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function () {
  ... do whatever you need to start timer here ...
});
</script>

before the script that loads MathJax. This will cause the function to be performed after MathJax has finished its typesetting (and if there isn't any typesetting, it will still get done).

If you don't load MathJax on every page, then do this on the pages that do include MathJax, and just start the timer directly on those that don't.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top