-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (34 loc) · 1.36 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><math-tex> demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.0.17/webcomponents-sd-ce.js"></script>
<script src="math-tex-controller.js"></script>
<script src="math-tex.js"></script>
<math-tex-controller></math-tex-controller>
</head>
<body>
<h1><code><math-tex></code> demo</h1>
<p>For <math-tex>n \in \mathbb N = 1, 2, 3, \ldots</math-tex> we have</p>
<math-tex mode="display">\sum_{k=1}^n k = \frac{n(n+1)}{2}</math-tex>
<p>The first two Fibonacci numbers are defined to be (<a href="#">click for more</a>):</p>
<ul id="fib-list">
<li><math-tex>F_0 = 0</math-tex></li>
<li><math-tex>F_1 = 1</math-tex></li>
</ul>
<script type="text/javascript">
document.querySelector('a').addEventListener('click', (function() {
var idx=1, a=0, b=1;
return function (ev) {
var li = document.createElement("li"), t = a + b;
ev.preventDefault();
a = b; b = t; idx++;
li.innerHTML = "<math-tex>F_{" + idx + "} = F_{" + (idx-1) + "} + F_{" + (idx-2) + "} = " + b + "</math-tex>";
document.getElementById("fib-list").appendChild(li);
};
})());
</script>
</body>
</html>