www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

sample-loader.html (1313B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Load MathJax after the page is ready</title>
      5 <!-- Copyright (c) 2012-2015 The MathJax Consortium -->
      6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      7 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      8 <meta name="viewport" content="width=device-width, initial-scale=1">
      9 
     10 <script type="text/javascript">
     11 //
     12 //  We wait for the onload function to show that MathJax is laoded after 
     13 //  the page is ready, and then use setTimeout to prove that MathJax is
     14 //  definitely loaded after the page is displayed and active.  MathJax is 
     15 //  loaded two seconds after the page is ready.
     16 //
     17 window.onload = function () {
     18   setTimeout(function () {
     19     var script = document.createElement("script");
     20     script.type = "text/javascript";
     21     script.src  = "../MathJax.js?config=TeX-AMS-MML_HTMLorMML";
     22     document.getElementsByTagName("head")[0].appendChild(script);
     23   },2000)
     24 }
     25 </script>
     26 
     27 <style>
     28 h1 {
     29   text-align: center;
     30   background: #CCCCCC;
     31   padding: .2em 1em;
     32   border-top: 3px solid #666666;
     33   border-bottom: 3px solid #999999;
     34 }
     35 </style>
     36 
     37 </head>
     38 <body>
     39 
     40 <h1>Adding MathJax After the Page is Loaded</h1>
     41 
     42 <p>
     43 When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
     44 $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
     45 </p>
     46 
     47 </body>
     48 </html>