-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
86 lines (82 loc) · 2.77 KB
/
index.html
File metadata and controls
86 lines (82 loc) · 2.77 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Temperature Visualization</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<link rel="stylesheet" href="style.css">
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
}
.tabs {
display: flex;
justify-content: center;
margin-bottom: 20px;
}
.tab {
padding: 10px 20px;
cursor: pointer;
font-size: 16px;
border: 1px solid #ccc;
background-color: #f9f9f9;
margin: 0 5px;
}
.tab.active {
background-color: #007bff;
color: white;
border-color: #007bff;
}
.content {
display: none;
}
.content.active {
display: block;
}
</style>
</head>
<body>
<div class="tabs">
<div id="tab-level1" class="tab active">Level 1</div>
<div id="tab-level2" class="tab">Level 2</div>
</div>
<div id="content-level1" class="content active">
<h2>Level 1</h2>
<div id="level1-container"></div>
</div>
<div id="content-level2" class="content">
<h2>Level 2</h2>
<div id="level2-container"></div>
</div>
<script>
let currentScript = null;
function loadScript(file) {
if (currentScript) {
document.body.removeChild(currentScript);
}
currentScript = document.createElement("script");
currentScript.src = file;
currentScript.type = "text/javascript";
currentScript.async = true;
document.body.appendChild(currentScript);
}
loadScript("level1.js");
document.getElementById("tab-level1").addEventListener("click", function() {
document.getElementById("content-level1").classList.add("active");
document.getElementById("content-level2").classList.remove("active");
document.getElementById("tab-level1").classList.add("active");
document.getElementById("tab-level2").classList.remove("active");
loadScript("level1.js");
});
document.getElementById("tab-level2").addEventListener("click", function() {
document.getElementById("content-level2").classList.add("active");
document.getElementById("content-level1").classList.remove("active");
document.getElementById("tab-level2").classList.add("active");
document.getElementById("tab-level1").classList.remove("active");
loadScript("level2.js");
});
</script>
</body>
</html>