Add about to homepage, add color script to templates

This commit is contained in:
Cassidy Williams committed 2022-08-22 23:39:41 -05:00
1 parent c43f69766e
commit 89b2038744
6 files changed
+65 -54

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
<script is:inline>
let colors = ['#24d05a', '#eb4888', '#10a2f5', '#e9bc3f'];
function getRandomColor() {
return colors[Math.floor(Math.random() * colors.length)];
}
function setRandomLinkColor() {
Array.from(document.getElementsByTagName('a')).forEach((e) => {
e.style.color = getRandomColor();
});
}
function setColorHoverListener() {
Array.from(document.querySelectorAll('a, button')).forEach((e) => {
e.addEventListener('mouseover', setRandomLinkColor);
});
}
(function () {
setRandomLinkColor();
setColorHoverListener();
setInterval(() => {
setRandomLinkColor();
}, 3000);
})();
</script>