Skip to content

Commit becceb1

Browse files
committed
cleanup
1 parent ea69bae commit becceb1

3 files changed

Lines changed: 152 additions & 383 deletions

File tree

gallery.md

Lines changed: 150 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Photographs from the Birol Labs over the years, including lab gatherings, confer
1010
</p>
1111

1212
<style>
13+
1314
.gallery-page .gallery-section {
1415
margin: 2.5rem 0;
1516
}
@@ -30,7 +31,7 @@ Photographs from the Birol Labs over the years, including lab gatherings, confer
3031
margin: 0;
3132
overflow: hidden;
3233
border-radius: 6px;
33-
transition: transform 0.25s ease;
34+
transition: transform .25s ease;
3435
}
3536

3637
.gallery-page .gallery a {
@@ -46,12 +47,12 @@ Photographs from the Birol Labs over the years, including lab gatherings, confer
4647
display: block;
4748
border: 1px solid #ddd;
4849
border-radius: 6px;
49-
background: #fff;
50+
background: white;
5051

5152
transition:
52-
transform 0.25s ease,
53-
box-shadow 0.25s ease,
54-
border-color 0.25s ease;
53+
transform .25s ease,
54+
box-shadow .25s ease,
55+
border-color .25s ease;
5556
}
5657

5758
.gallery-page .gallery figure:hover {
@@ -60,27 +61,90 @@ Photographs from the Birol Labs over the years, including lab gatherings, confer
6061

6162
.gallery-page .gallery figure:hover img {
6263
transform: scale(1.03);
63-
box-shadow: 0 8px 20px rgba(0,0,0,0.18);
64+
box-shadow: 0 8px 20px rgba(0,0,0,.18);
6465
border-color: #bbb;
6566
}
6667

6768
.gallery-page .gallery figcaption {
68-
margin-top: 0.6rem;
69+
margin-top: .6rem;
6970
text-align: center;
70-
font-size: 0.9em;
71+
font-size: .9em;
7172
color: #666;
72-
transition: color 0.25s ease;
73+
transition: color .25s ease;
7374
}
7475

7576
.gallery-page .gallery figure:hover figcaption {
7677
color: #222;
7778
}
7879

79-
/* Nice keyboard accessibility */
8080
.gallery-page .gallery a:focus img {
8181
outline: none;
82-
box-shadow: 0 0 0 3px rgba(0,120,255,0.35);
82+
box-shadow: 0 0 0 3px rgba(0,120,255,.35);
83+
}
84+
85+
/* ===========================
86+
LIGHTBOX
87+
=========================== */
88+
89+
#lightbox {
90+
position: fixed;
91+
inset: 0;
92+
background: rgba(0,0,0,.9);
93+
94+
display: flex;
95+
justify-content: center;
96+
align-items: center;
97+
98+
opacity: 0;
99+
visibility: hidden;
100+
101+
transition: opacity .25s ease;
102+
z-index: 9999;
103+
}
104+
105+
#lightbox.show {
106+
opacity: 1;
107+
visibility: visible;
108+
}
109+
110+
#lightbox img {
111+
max-width: 92vw;
112+
max-height: 92vh;
113+
114+
border-radius: 6px;
115+
box-shadow: 0 15px 40px rgba(0,0,0,.45);
116+
117+
cursor: zoom-out;
118+
119+
animation: zoomIn .25s ease;
120+
}
121+
122+
#lightbox-close {
123+
position: absolute;
124+
top: 20px;
125+
right: 30px;
126+
127+
font-size: 40px;
128+
color: white;
129+
130+
cursor: pointer;
131+
user-select: none;
132+
}
133+
134+
@keyframes zoomIn {
135+
136+
from {
137+
transform: scale(.92);
138+
opacity: 0;
139+
}
140+
141+
to {
142+
transform: scale(1);
143+
opacity: 1;
144+
}
145+
83146
}
147+
84148
</style>
85149

86150
<!-- ===================== -->
@@ -229,3 +293,78 @@ Photographs from the Birol Labs over the years, including lab gatherings, confer
229293
</div>
230294

231295
</div>
296+
297+
<!-- ===========================
298+
LIGHTBOX OVERLAY
299+
=========================== -->
300+
301+
<div id="lightbox">
302+
303+
<span id="lightbox-close">&times;</span>
304+
305+
<img id="lightbox-image" src="" alt="Expanded image">
306+
307+
</div>
308+
309+
<script>
310+
311+
document.addEventListener("DOMContentLoaded", function () {
312+
313+
const lightbox = document.getElementById("lightbox");
314+
const lightboxImg = document.getElementById("lightbox-image");
315+
const closeBtn = document.getElementById("lightbox-close");
316+
317+
// Attach to every gallery image automatically
318+
document.querySelectorAll(".gallery-page a").forEach(function(link) {
319+
320+
const href = link.getAttribute("href") || "";
321+
322+
if (!href.match(/\.(png|jpg|jpeg|gif|webp)$/i))
323+
return;
324+
325+
link.addEventListener("click", function(e) {
326+
327+
e.preventDefault();
328+
329+
lightboxImg.src = href;
330+
lightbox.classList.add("show");
331+
document.body.style.overflow = "hidden";
332+
333+
});
334+
335+
});
336+
337+
function closeLightbox() {
338+
339+
lightbox.classList.remove("show");
340+
341+
document.body.style.overflow = "";
342+
343+
// remove image after fade-out
344+
setTimeout(function() {
345+
lightboxImg.src = "";
346+
}, 250);
347+
348+
}
349+
350+
closeBtn.addEventListener("click", closeLightbox);
351+
352+
lightbox.addEventListener("click", function(e) {
353+
354+
if (e.target === lightbox) {
355+
closeLightbox();
356+
}
357+
358+
});
359+
360+
document.addEventListener("keydown", function(e) {
361+
362+
if (e.key === "Escape") {
363+
closeLightbox();
364+
}
365+
366+
});
367+
368+
});
369+
370+
</script>

0 commit comments

Comments
 (0)