-
Notifications
You must be signed in to change notification settings - Fork 0
/
map-integration.html
30 lines (30 loc) · 1.01 KB
/
map-integration.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Map Integration</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<canvas id="earcut" class="toggable"></canvas>
<div id="unionized" class="toggable"></div>
<script type="module" src="map-integration.js"></script>
<script>
// Toggle visibility of the canvas and the div
let visibilityState = 0;
const toggableElements = document.querySelectorAll(".toggable");
function toggleVisibility() {
toggableElements.forEach((element, index) => {
element.style.display =
visibilityState === 0 || visibilityState === index + 1
? "block"
: "none";
});
visibilityState = (visibilityState + 1) % (toggableElements.length + 1);
}
toggleVisibility();
document.addEventListener("click", toggleVisibility);
</script>
</body>
</html>