blob: 189bb7bb0f92b9d1d28cee706d424318646f4179 (
plain) (
blame)
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
|
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8" />
<title>Särskilda kommandorörselsegruppen</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: grid;
place-items: center;
min-height: 100vh;
background-color: black;
color: white;
font-family: monospace;
}
span {
position: relative;
}
.invisible {
display: none;
}
</style>
</head>
<body>
<h1>Särskilda kommandorörelsegruppen</h1>
<script>
const el = document.querySelector("h1");
const text = el.textContent;
el.innerHTML = "";
const spans = new Array(text.length).fill().map((_, i) => {
const span = document.createElement("span");
span.innerText = text[i];
span.classList.add("invisible");
el.appendChild(span);
return span;
});
const underscore = document.createElement("span");
const underscoreInner = document.createElement("span");
underscoreInner.innerText = "_";
underscore.appendChild(underscoreInner);
underscore.style.position = "relative";
underscoreInner.style.position = "absolute";
el.appendChild(underscore);
let i = 0;
const interval = setInterval(() => {
spans[i].classList.remove("invisible");
i++;
if (i >= spans.length) {
clearInterval(interval);
setTimeout(removeCursor, 200);
}
}, 100);
function removeCursor() {
underscore.classList.add("invisible");
}
</script>
</body>
</html>
|