summaryrefslogtreecommitdiffstats
path: root/content/script.js
blob: 5702edffecf41f2b28bfd57a88d54af86df126e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function createSnowFlake() {
	const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use");

    snowFlakeInner.setAttribute("href", "/symbols.svg#icon-asterisk");

    snowFlake.classList.add("o-icon");
    snowFlake.classList.add("o-icon--snow");
    snowFlake.ariaHidden = true;

	snowFlake.style.width = Math.random() * 10 + 10 + 'px';
	snowFlake.style.left = Math.random() * window.innerWidth + 'px';
	snowFlake.style.animationDuration = Math.random() * 3 + 2 + 's';
	snowFlake.style.opacity = Math.random();

    snowFlake.appendChild(snowFlakeInner);
	document.body.appendChild(snowFlake);

	setTimeout(() => { snowFlake.remove(); }, 5000);
}

window.addEventListener("load", () => { setInterval(createSnowFlake, 100); })