working
This commit is contained in:
@ -1,15 +1,3 @@
|
||||
<link rel="stylesheet" href="/web/seasonal/halloween.css">
|
||||
<div class="halloween-container" aria-hidden="true">
|
||||
<div class="halloween"> <img src="/web/seasonal/ghost_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/bat_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/pumpkin_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/ghost_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/bat_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/pumpkin_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/ghost_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/bat_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/pumpkin_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/ghost_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/bat_20x20.png"> </div>
|
||||
<div class="halloween"> <img src="/web/seasonal/pumpkin_20x20.png"> </div>
|
||||
</div>
|
||||
<script src="/seasonals/halloween.js"></script>
|
||||
<link rel="stylesheet" href="/seasonal/halloween.css">
|
||||
<div class="halloween-container"></div>
|
@ -6,10 +6,24 @@
|
||||
}
|
||||
|
||||
.halloween {
|
||||
color: #fff;
|
||||
font-size: 1em;
|
||||
font-family: Arial, sans-serif;
|
||||
text-shadow: 0 0 5px #000;
|
||||
position: fixed;
|
||||
bottom: -10%;
|
||||
z-index: 0;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
cursor: default;
|
||||
-webkit-animation-name: halloween-fall, halloween-shake;
|
||||
-webkit-animation-duration: 10s, 3s;
|
||||
-webkit-animation-timing-function: linear, ease-in-out;
|
||||
-webkit-animation-iteration-count: infinite, infinite;
|
||||
-webkit-animation-play-state: running, running;
|
||||
animation-name: halloween-fall, halloween-shake;
|
||||
animation-duration: 10s, 3s;
|
||||
animation-timing-function: linear, ease-in-out;
|
||||
animation-iteration-count: infinite, infinite;
|
||||
animation-play-state: running, running
|
||||
}
|
||||
|
||||
@-webkit-keyframes halloween-fall {
|
||||
@ -58,94 +72,73 @@
|
||||
}
|
||||
}
|
||||
|
||||
.snowflake {
|
||||
position: fixed;
|
||||
bottom: -10%;
|
||||
z-index: 0;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
cursor: default;
|
||||
-webkit-animation-name: halloween-fall, halloween-shake;
|
||||
-webkit-animation-duration: 10s, 3s;
|
||||
-webkit-animation-timing-function: linear, ease-in-out;
|
||||
-webkit-animation-iteration-count: infinite, infinite;
|
||||
-webkit-animation-play-state: running, running;
|
||||
animation-name: halloween-fall, halloween-shake;
|
||||
animation-duration: 10s, 3s;
|
||||
animation-timing-function: linear, ease-in-out;
|
||||
animation-iteration-count: infinite, infinite;
|
||||
animation-play-state: running, running
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(0) {
|
||||
.halloween:nth-of-type(0) {
|
||||
left: 1%;
|
||||
-webkit-animation-delay: 0s, 0s;
|
||||
animation-delay: 0s, 0s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(1) {
|
||||
.halloween:nth-of-type(1) {
|
||||
left: 10%;
|
||||
-webkit-animation-delay: 1s, 1s;
|
||||
animation-delay: 1s, 1s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(2) {
|
||||
.halloween:nth-of-type(2) {
|
||||
left: 20%;
|
||||
-webkit-animation-delay: 6s, .5s;
|
||||
animation-delay: 6s, .5s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(3) {
|
||||
.halloween:nth-of-type(3) {
|
||||
left: 30%;
|
||||
-webkit-animation-delay: 4s, 2s;
|
||||
animation-delay: 4s, 2s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(4) {
|
||||
.halloween:nth-of-type(4) {
|
||||
left: 40%;
|
||||
-webkit-animation-delay: 2s, 2s;
|
||||
animation-delay: 2s, 2s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(5) {
|
||||
.halloween:nth-of-type(5) {
|
||||
left: 50%;
|
||||
-webkit-animation-delay: 8s, 3s;
|
||||
animation-delay: 8s, 3s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(6) {
|
||||
.halloween:nth-of-type(6) {
|
||||
left: 60%;
|
||||
-webkit-animation-delay: 6s, 2s;
|
||||
animation-delay: 6s, 2s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(7) {
|
||||
.halloween:nth-of-type(7) {
|
||||
left: 70%;
|
||||
-webkit-animation-delay: 2.5s, 1s;
|
||||
animation-delay: 2.5s, 1s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(8) {
|
||||
.halloween:nth-of-type(8) {
|
||||
left: 80%;
|
||||
-webkit-animation-delay: 1s, 0s;
|
||||
animation-delay: 1s, 0s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(9) {
|
||||
.halloween:nth-of-type(9) {
|
||||
left: 90%;
|
||||
-webkit-animation-delay: 3s, 1.5s;
|
||||
animation-delay: 3s, 1.5s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(10) {
|
||||
.halloween:nth-of-type(10) {
|
||||
left: 25%;
|
||||
-webkit-animation-delay: 2s, 0s;
|
||||
animation-delay: 2s, 0s
|
||||
}
|
||||
|
||||
.snowflake:nth-of-type(11) {
|
||||
.halloween:nth-of-type(11) {
|
||||
left: 65%;
|
||||
-webkit-animation-delay: 4s, 2.5s;
|
||||
animation-delay: 4s, 2.5s
|
||||
|
44
halloween.js
44
halloween.js
@ -38,41 +38,40 @@ observer.observe(document.body, {
|
||||
attributes: true // observe changes to attributes (e.g. class changes)
|
||||
});
|
||||
|
||||
/*
|
||||
const images = [
|
||||
"/web/seasonal/ghost_20x20.png",
|
||||
"/web/seasonal/bat_20x20.png",
|
||||
"/web/seasonal/pumpkin_20x20.png",
|
||||
"/web/seasonal/ghost_20x20.png",
|
||||
"/web/seasonal/bat_20x20.png",
|
||||
"/web/seasonal/pumpkin_20x20.png",
|
||||
"/web/seasonal/ghost_20x20.png",
|
||||
"/web/seasonal/bat_20x20.png",
|
||||
"/web/seasonal/pumpkin_20x20.png",
|
||||
"/web/seasonal/ghost_20x20.png",
|
||||
"/web/seasonal/bat_20x20.png",
|
||||
"/web/seasonal/pumpkin_20x20.png",
|
||||
];*/
|
||||
const images = [
|
||||
"./images/ghost_20x20.png",
|
||||
"./images/bat_20x20.png",
|
||||
"./images/pumpkin_20x20.png",
|
||||
];
|
||||
|
||||
// create halloween objects
|
||||
function createHalloween() {
|
||||
const container = document.querySelector('halloween-container') || document.createElement("div");
|
||||
|
||||
if (!document.querySelector('halloween-container')) {
|
||||
container.className = "halloween-container";
|
||||
container.setAttribute("aria-hidden", "true");
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
const container = document.querySelector('.halloween-container') || document.createElement("div");
|
||||
|
||||
if (!document.querySelector('.halloween-container')) {
|
||||
container.className = "halloween-container";
|
||||
container.setAttribute("aria-hidden", "true");
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
images.forEach(imageSrc => {
|
||||
const halloweenDiv = document.createElement("div");
|
||||
halloweenDiv.className = "halloween";
|
||||
const halloweenDiv = document.createElement("div");
|
||||
halloweenDiv.className = "halloween";
|
||||
|
||||
const img = document.createElement("img");
|
||||
img.src = imageSrc;
|
||||
const img = document.createElement("img");
|
||||
img.src = imageSrc;
|
||||
|
||||
halloweenDiv.appendChild(img);
|
||||
container.appendChild(halloweenDiv);
|
||||
halloweenDiv.appendChild(img);
|
||||
container.appendChild(halloweenDiv);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -80,4 +79,5 @@ function createHalloween() {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (!halloween) return; // exit if halloween is disabled
|
||||
createHalloween();
|
||||
toogleHalloween();
|
||||
});
|
||||
|
BIN
images/bat_20x20.png
Normal file
BIN
images/bat_20x20.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
BIN
images/ghost_20x20.png
Normal file
BIN
images/ghost_20x20.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
images/lep_30x30.png
Normal file
BIN
images/lep_30x30.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
images/pumpkin_20x20.png
Normal file
BIN
images/pumpkin_20x20.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
22
test-site.html
Normal file
22
test-site.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Halloween Display</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
background-color: black;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<link rel="stylesheet" href="halloween.css">
|
||||
<script src="halloween.js"></script>
|
||||
<div class="halloween-container" aria-hidden="true"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user