small fixes

This commit is contained in:
Julian Brammer 2024-11-25 00:50:16 +01:00
parent 13f6399fc0
commit dbf2efc957
2 changed files with 30 additions and 4 deletions

View File

@ -116,14 +116,13 @@ header .names {
header h1, header p {
text-align: left;
font-size: 35px;
color: var(--color-primary);
font-family: pilowlava, monospace;
}
header p {
font-family: space-mono, monospace;
font-size: 25px;
font-size: 20px;
}
header img {
@ -134,7 +133,7 @@ header img {
/* Description */
header, .description, .linkGroup, .timer, footer {
background-color: rgba(15, 0, 10, 0.9);
background-color: rgba(15, 0, 10, 0.8);
/*border: 1px var(--color-primary) solid;*/
border: 1px var(--color-accent-c) solid;
}

View File

@ -86,10 +86,29 @@ document.addEventListener('DOMContentLoaded', () => {
const color = Math.random() > 0.5 ? '_red' : '';
createBlob(blobContainer, 'line', `blob-freeform-${x}${color}.svg`, zIndexCounter - 1, position);
}
if (isMobileView()) {
toggleMouseEffects(false);
} else {
toggleMouseEffects(true);
}
});
document.addEventListener('mousemove', (event) => {
function isMobileView() {
return window.innerWidth <= 480;
}
function toggleMouseEffects(enable) {
if (enable) {
document.addEventListener('mousemove', handleMouseMovement);
} else {
document.removeEventListener('mousemove', handleMouseMovement);
}
}
function handleMouseMovement(event) {
const elements = [...document.querySelectorAll('.solid, .line')];
const { clientX: mouseX, clientY: mouseY } = event;
const { innerWidth: width, innerHeight: height } = window;
@ -102,4 +121,12 @@ document.addEventListener('mousemove', (event) => {
const rotation = element.dataset.rotation || 0;
element.style.transform = `translate(-50%, -50%) translate(${xOffset / strength}px, ${yOffset / strength}px) rotate(${rotation}deg)`;
});
}
window.addEventListener('resize', () => {
if (isMobileView()) {
toggleMouseEffects(false);
} else {
toggleMouseEffects(true);
}
});