Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ <h3>Contact</h3>
});

box.addEventListener("click", e => {
// Don't lock/unlock if a contact link was tapped
if (e.target.closest('.contact-icon')) return;
e.stopPropagation();
if (locked === box) {
unlock();
Expand All @@ -175,6 +177,27 @@ <h3>Contact</h3>
locked = null;
}

// Touch: first tap expands icon, second tap navigates
const isTouchDevice = matchMedia('(hover: none) and (pointer: coarse)').matches;
if (isTouchDevice) {
document.querySelectorAll('.contact-icon').forEach(icon => {
icon.addEventListener('click', e => {
if (!icon.classList.contains('expanded')) {
e.preventDefault();
document.querySelectorAll('.contact-icon.expanded').forEach(i => i.classList.remove('expanded'));
icon.classList.add('expanded');
}
});
});

// Tap outside collapses expanded icon
document.addEventListener('click', e => {
if (!e.target.closest('.contact-icon')) {
document.querySelectorAll('.contact-icon.expanded').forEach(i => i.classList.remove('expanded'));
}
});
}

// Disable right click
document.addEventListener("contextmenu", e => e.preventDefault());

Expand Down
24 changes: 24 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ boxes.forEach(box => {
----------------------------- */
boxes.forEach(box => {
box.addEventListener("click", e => {
// Don't lock/unlock if a contact link was tapped
if (e.target.closest('.contact-icon')) return;
e.stopPropagation();

// If clicking the same box → unlock
Expand Down Expand Up @@ -60,3 +62,25 @@ function unlock() {
lockedBox = null;
}

/* -----------------------------
TOUCH: TAP-TO-EXPAND ICONS
----------------------------- */
const isTouchDevice = matchMedia('(hover: none) and (pointer: coarse)').matches;
if (isTouchDevice) {
document.querySelectorAll('.contact-icon').forEach(icon => {
icon.addEventListener('click', e => {
if (!icon.classList.contains('expanded')) {
e.preventDefault();
document.querySelectorAll('.contact-icon.expanded').forEach(i => i.classList.remove('expanded'));
icon.classList.add('expanded');
}
});
});

document.addEventListener('click', e => {
if (!e.target.closest('.contact-icon')) {
document.querySelectorAll('.contact-icon.expanded').forEach(i => i.classList.remove('expanded'));
}
});
}

19 changes: 8 additions & 11 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,12 @@ body.loaded .right-bottom {
opacity: 0;
font-size: 1rem;
font-weight: 600;
color: #fff;
color: var(--accent-red-deep);
transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
pointer-events: none;
z-index: 1;
font-family: 'Playfair Display', serif;
letter-spacing: 0.5px;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hover/Focus State */
Expand Down Expand Up @@ -614,6 +613,8 @@ body.loaded .right-bottom {
.contact-icon:focus-visible span {
opacity: 1;
transform: translateX(4px);
color: #fff;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Premium Glow Effect */
Expand Down Expand Up @@ -833,13 +834,6 @@ body.loaded .right-bottom {
gap: 12px;
}

.box.active .contact-icon {
width: 150px;
}

.box.active .contact-icon span {
opacity: 1;
}
}

/* =================================================
Expand All @@ -859,12 +853,15 @@ body.loaded .right-bottom {
display: none;
}

.contact-icon:active {
.contact-icon.expanded {
width: 150px;
justify-content: flex-start;
padding-left: 18px;
}

.contact-icon:active span {
.contact-icon.expanded span {
opacity: 1;
color: var(--accent-red-deep);
}
}

Expand Down