working
This commit is contained in:
@@ -1,15 +1,3 @@
|
|||||||
<link rel="stylesheet" href="/web/seasonal/halloween.css">
|
<script src="/seasonals/halloween.js"></script>
|
||||||
<div class="halloween-container" aria-hidden="true">
|
<link rel="stylesheet" href="/seasonal/halloween.css">
|
||||||
<div class="halloween"> <img src="/web/seasonal/ghost_20x20.png"> </div>
|
<div class="halloween-container"></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>
|
|
@@ -6,10 +6,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.halloween {
|
.halloween {
|
||||||
color: #fff;
|
position: fixed;
|
||||||
font-size: 1em;
|
bottom: -10%;
|
||||||
font-family: Arial, sans-serif;
|
z-index: 0;
|
||||||
text-shadow: 0 0 5px #000;
|
-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 {
|
@-webkit-keyframes halloween-fall {
|
||||||
@@ -58,94 +72,73 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake {
|
.halloween:nth-of-type(0) {
|
||||||
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) {
|
|
||||||
left: 1%;
|
left: 1%;
|
||||||
-webkit-animation-delay: 0s, 0s;
|
-webkit-animation-delay: 0s, 0s;
|
||||||
animation-delay: 0s, 0s
|
animation-delay: 0s, 0s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(1) {
|
.halloween:nth-of-type(1) {
|
||||||
left: 10%;
|
left: 10%;
|
||||||
-webkit-animation-delay: 1s, 1s;
|
-webkit-animation-delay: 1s, 1s;
|
||||||
animation-delay: 1s, 1s
|
animation-delay: 1s, 1s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(2) {
|
.halloween:nth-of-type(2) {
|
||||||
left: 20%;
|
left: 20%;
|
||||||
-webkit-animation-delay: 6s, .5s;
|
-webkit-animation-delay: 6s, .5s;
|
||||||
animation-delay: 6s, .5s
|
animation-delay: 6s, .5s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(3) {
|
.halloween:nth-of-type(3) {
|
||||||
left: 30%;
|
left: 30%;
|
||||||
-webkit-animation-delay: 4s, 2s;
|
-webkit-animation-delay: 4s, 2s;
|
||||||
animation-delay: 4s, 2s
|
animation-delay: 4s, 2s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(4) {
|
.halloween:nth-of-type(4) {
|
||||||
left: 40%;
|
left: 40%;
|
||||||
-webkit-animation-delay: 2s, 2s;
|
-webkit-animation-delay: 2s, 2s;
|
||||||
animation-delay: 2s, 2s
|
animation-delay: 2s, 2s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(5) {
|
.halloween:nth-of-type(5) {
|
||||||
left: 50%;
|
left: 50%;
|
||||||
-webkit-animation-delay: 8s, 3s;
|
-webkit-animation-delay: 8s, 3s;
|
||||||
animation-delay: 8s, 3s
|
animation-delay: 8s, 3s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(6) {
|
.halloween:nth-of-type(6) {
|
||||||
left: 60%;
|
left: 60%;
|
||||||
-webkit-animation-delay: 6s, 2s;
|
-webkit-animation-delay: 6s, 2s;
|
||||||
animation-delay: 6s, 2s
|
animation-delay: 6s, 2s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(7) {
|
.halloween:nth-of-type(7) {
|
||||||
left: 70%;
|
left: 70%;
|
||||||
-webkit-animation-delay: 2.5s, 1s;
|
-webkit-animation-delay: 2.5s, 1s;
|
||||||
animation-delay: 2.5s, 1s
|
animation-delay: 2.5s, 1s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(8) {
|
.halloween:nth-of-type(8) {
|
||||||
left: 80%;
|
left: 80%;
|
||||||
-webkit-animation-delay: 1s, 0s;
|
-webkit-animation-delay: 1s, 0s;
|
||||||
animation-delay: 1s, 0s
|
animation-delay: 1s, 0s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(9) {
|
.halloween:nth-of-type(9) {
|
||||||
left: 90%;
|
left: 90%;
|
||||||
-webkit-animation-delay: 3s, 1.5s;
|
-webkit-animation-delay: 3s, 1.5s;
|
||||||
animation-delay: 3s, 1.5s
|
animation-delay: 3s, 1.5s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(10) {
|
.halloween:nth-of-type(10) {
|
||||||
left: 25%;
|
left: 25%;
|
||||||
-webkit-animation-delay: 2s, 0s;
|
-webkit-animation-delay: 2s, 0s;
|
||||||
animation-delay: 2s, 0s
|
animation-delay: 2s, 0s
|
||||||
}
|
}
|
||||||
|
|
||||||
.snowflake:nth-of-type(11) {
|
.halloween:nth-of-type(11) {
|
||||||
left: 65%;
|
left: 65%;
|
||||||
-webkit-animation-delay: 4s, 2.5s;
|
-webkit-animation-delay: 4s, 2.5s;
|
||||||
animation-delay: 4s, 2.5s
|
animation-delay: 4s, 2.5s
|
||||||
|
22
halloween.js
22
halloween.js
@@ -38,31 +38,29 @@ observer.observe(document.body, {
|
|||||||
attributes: true // observe changes to attributes (e.g. class changes)
|
attributes: true // observe changes to attributes (e.g. class changes)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
const images = [
|
const images = [
|
||||||
"/web/seasonal/ghost_20x20.png",
|
"/web/seasonal/ghost_20x20.png",
|
||||||
"/web/seasonal/bat_20x20.png",
|
"/web/seasonal/bat_20x20.png",
|
||||||
"/web/seasonal/pumpkin_20x20.png",
|
"/web/seasonal/pumpkin_20x20.png",
|
||||||
"/web/seasonal/ghost_20x20.png",
|
];*/
|
||||||
"/web/seasonal/bat_20x20.png",
|
const images = [
|
||||||
"/web/seasonal/pumpkin_20x20.png",
|
"./images/ghost_20x20.png",
|
||||||
"/web/seasonal/ghost_20x20.png",
|
"./images/bat_20x20.png",
|
||||||
"/web/seasonal/bat_20x20.png",
|
"./images/pumpkin_20x20.png",
|
||||||
"/web/seasonal/pumpkin_20x20.png",
|
|
||||||
"/web/seasonal/ghost_20x20.png",
|
|
||||||
"/web/seasonal/bat_20x20.png",
|
|
||||||
"/web/seasonal/pumpkin_20x20.png",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// create halloween objects
|
// create halloween objects
|
||||||
function createHalloween() {
|
function createHalloween() {
|
||||||
const container = document.querySelector('halloween-container') || document.createElement("div");
|
const container = document.querySelector('.halloween-container') || document.createElement("div");
|
||||||
|
|
||||||
if (!document.querySelector('halloween-container')) {
|
if (!document.querySelector('.halloween-container')) {
|
||||||
container.className = "halloween-container";
|
container.className = "halloween-container";
|
||||||
container.setAttribute("aria-hidden", "true");
|
container.setAttribute("aria-hidden", "true");
|
||||||
document.body.appendChild(container);
|
document.body.appendChild(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < 4; i++) {
|
||||||
images.forEach(imageSrc => {
|
images.forEach(imageSrc => {
|
||||||
const halloweenDiv = document.createElement("div");
|
const halloweenDiv = document.createElement("div");
|
||||||
halloweenDiv.className = "halloween";
|
halloweenDiv.className = "halloween";
|
||||||
@@ -74,10 +72,12 @@ function createHalloween() {
|
|||||||
container.appendChild(halloweenDiv);
|
container.appendChild(halloweenDiv);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// initialize halloween after the DOM is loaded
|
// initialize halloween after the DOM is loaded
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (!halloween) return; // exit if halloween is disabled
|
if (!halloween) return; // exit if halloween is disabled
|
||||||
createHalloween();
|
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