feat: implemented a "fade in" animation on every page

This commit is contained in:
Laureηt 2021-08-30 13:43:46 +02:00
parent 92b0652cda
commit 1eae4e9de7
No known key found for this signature in database
GPG key ID: D88C6B294FD40994
3 changed files with 65 additions and 37 deletions

View file

@ -4,7 +4,7 @@ username: Laureηt
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ username }}</title> <title>{{ username }}</title>
@ -12,39 +12,46 @@ username: Laureηt
<link rel="stylesheet" href="{{ '/css/blink.css' | url }}"> <link rel="stylesheet" href="{{ '/css/blink.css' | url }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.ico' | url }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.ico' | url }}">
<script src="{{ '/javascript/chaffle.min.js' | url }}"></script> <script src="{{ '/javascript/chaffle.min.js' | url }}"></script>
</head> </head>
<body> <body>
<header> <header>
<span data-chaffle-onload="" data-chaffle="en">{{ username }}</span> <span data-chaffle-onload="" data-chaffle="en">{{ username }}</span>
<span class="blink" style="display:inline;">_</span> <span class="blink" style="display:inline;">_</span>
</header> </header>
{{ content | safe }} {{ content | safe }}
<footer> <footer>
&copy; {% year %} {{ username }} &copy; {% year %}
{{ username }}
</footer> </footer>
<script> <script>
var elm_mouseover = document.querySelectorAll('[data-chaffle]'); var elm_mouseover = document.querySelectorAll('[data-chaffle]');
var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]'); var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]');
Array.prototype.forEach.call(elm_mouseover, function (el) { Array
.prototype
.forEach
.call(elm_mouseover, function (el) {
var chaffle = new Chaffle(el) var chaffle = new Chaffle(el)
el.addEventListener('mouseover', function () { el.addEventListener('mouseover', function () {
chaffle.init(); chaffle.init();
}); });
}); });
Array.prototype.forEach.call(elm_onload, function (el) { Array
.prototype
.forEach
.call(elm_onload, function (el) {
var chaffle = new Chaffle(el) var chaffle = new Chaffle(el)
chaffle.init(); chaffle.init();
setInterval(function(){ setInterval(function () {
chaffle.init(); chaffle.init();
}, 10000) }, 10000)
}); });
</script> </script>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@ username: Laureηt
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ username }}</title> <title>{{ username }}</title>
@ -12,13 +12,13 @@ username: Laureηt
<link rel="stylesheet" href="{{ '/css/blink.css' | url }}"> <link rel="stylesheet" href="{{ '/css/blink.css' | url }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.ico' | url }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.ico' | url }}">
<script src="{{ '/javascript/chaffle.min.js' | url }}"></script> <script src="{{ '/javascript/chaffle.min.js' | url }}"></script>
</head> </head>
<body> <body>
<header style="margin-bottom: 0;"> <header style="margin-bottom: 0;">
<span data-chaffle-onload="" data-chaffle="en">{{ username }}</span> <span data-chaffle-onload="" data-chaffle="en">{{ username }}</span>
<span class="blink" style="display:inline;">_</span> <span class="blink" style="display:inline;">_</span>
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }} {{ collections.all | eleventyNavigation | eleventyNavigationToHtml | safe }}
</header> </header>
<hr style="margin-top: .5em;"> <hr style="margin-top: .5em;">
@ -30,28 +30,35 @@ username: Laureηt
</div> </div>
<footer> <footer>
&copy; {% year %} {{ username }} &copy; {% year %}
{{ username }}
</footer> </footer>
<script> <script>
var elm_mouseover = document.querySelectorAll('[data-chaffle]'); var elm_mouseover = document.querySelectorAll('[data-chaffle]');
var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]'); var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]');
Array.prototype.forEach.call(elm_mouseover, function (el) { Array
.prototype
.forEach
.call(elm_mouseover, function (el) {
var chaffle = new Chaffle(el) var chaffle = new Chaffle(el)
el.addEventListener('mouseover', function () { el.addEventListener('mouseover', function () {
chaffle.init(); chaffle.init();
}); });
}); });
Array.prototype.forEach.call(elm_onload, function (el) { Array
.prototype
.forEach
.call(elm_onload, function (el) {
var chaffle = new Chaffle(el) var chaffle = new Chaffle(el)
chaffle.init(); chaffle.init();
setInterval(function(){ setInterval(function () {
chaffle.init(); chaffle.init();
}, 10000) }, 10000)
}); });
</script> </script>
</body> </body>
</html> </html>

View file

@ -14,6 +14,8 @@ body {
max-width: 40em; max-width: 40em;
margin: 0 auto; margin: 0 auto;
padding: 1em; padding: 1em;
animation: intro .3s both;
animation-delay: .15s;
} }
body, body,
@ -89,6 +91,7 @@ footer {
body { body {
font-size: 17px; font-size: 17px;
} }
ol, ol,
ul { ul {
padding-left: 17px; padding-left: 17px;
@ -112,3 +115,14 @@ header>ul>li {
display: inline; display: inline;
margin-right: .5em; margin-right: .5em;
} }
@keyframes intro {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}