In-post event gallery block + lightbox; mobile polish
- Reusable "Photos from the event" grid (shows 5 thumbnails + "+N more") that opens a full-screen lightbox (arrows / keyboard / swipe / Esc); added to the Meet Student Slovenia 2024 post as the pattern - New css/components/_lightbox.css + setupLightbox() in main.js (injects one shared overlay, wires any .js-lightbox grid) - Mobile polish: gallery albums go single-column on phones, two on tablets; event-gallery grid 3-up on mobile; lightbox sizing/controls tuned for small screens Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
24c77e6171
commit
1f5e031be9
5 files changed
+183
-6
No files matched your search
@@ -0,0 +1,75 @@
|
||||
/* ==========================================================================
|
||||
Reusable photo gallery block ("Photos from the event") + lightbox
|
||||
Drop a .event-gallery-grid.js-lightbox anywhere; main.js wires the viewer.
|
||||
========================================================================== */
|
||||
.event-gallery { margin: 48px 0 8px; }
|
||||
.event-gallery-title {
|
||||
font-size: 22px; font-weight: 700; color: #101828; margin: 0 0 16px;
|
||||
}
|
||||
.event-gallery-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 8px;
|
||||
}
|
||||
.eg-thumb {
|
||||
padding: 0; border: none; background: #EEF2F4;
|
||||
border-radius: 8px; overflow: hidden; cursor: pointer;
|
||||
aspect-ratio: 1; position: relative; display: block;
|
||||
}
|
||||
.eg-thumb img {
|
||||
width: 100%; height: 100%; object-fit: cover; display: block;
|
||||
transition: transform 0.4s ease;
|
||||
}
|
||||
.eg-thumb:hover img { transform: scale(1.06); }
|
||||
.eg-thumb:focus-visible { outline: 2px solid #2D738C; outline-offset: 2px; }
|
||||
.eg-thumb.is-hidden { display: none; }
|
||||
.eg-more {
|
||||
position: absolute; inset: 0; z-index: 2;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
background: rgba(9, 18, 26, 0.55);
|
||||
color: #FFFFFF; font-size: 18px; font-weight: 700;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ---------- Full-screen lightbox (injected once by main.js) ---------- */
|
||||
.lightbox {
|
||||
position: fixed; inset: 0; z-index: 2000;
|
||||
display: none; align-items: center; justify-content: center;
|
||||
background: rgba(9, 18, 26, 0.93); padding: 24px;
|
||||
}
|
||||
.lightbox.is-open { display: flex; }
|
||||
.lightbox-img {
|
||||
max-width: 92vw; max-height: 82vh; object-fit: contain;
|
||||
border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||
user-select: none; -webkit-user-drag: none;
|
||||
}
|
||||
.lightbox-close, .lightbox-prev, .lightbox-next {
|
||||
position: absolute; background: rgba(255, 255, 255, 0.12);
|
||||
color: #FFFFFF; border: none; cursor: pointer; border-radius: 50%;
|
||||
width: 48px; height: 48px; font-size: 24px; line-height: 1;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
transition: background 0.15s ease;
|
||||
}
|
||||
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, 0.25); }
|
||||
.lightbox-close { top: 20px; right: 20px; font-size: 28px; }
|
||||
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
|
||||
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }
|
||||
.lightbox-caption {
|
||||
position: absolute; bottom: 18px; left: 0; right: 0;
|
||||
text-align: center; color: rgba(255, 255, 255, 0.85);
|
||||
font-size: 14px; padding: 0 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.event-gallery { margin: 36px 0 8px; }
|
||||
.event-gallery-title { font-size: 19px; margin: 0 0 12px; }
|
||||
.event-gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.lightbox { padding: 12px; }
|
||||
.lightbox-img { max-width: 96vw; max-height: 80vh; }
|
||||
.lightbox-prev { left: 8px; }
|
||||
.lightbox-next { right: 8px; }
|
||||
.lightbox-close { top: 12px; right: 12px; }
|
||||
.lightbox-caption { font-size: 12.5px; bottom: 12px; }
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
@import 'components/_buttons.css';
|
||||
@import 'components/_cards.css';
|
||||
@import 'components/_lang-banner.css';
|
||||
@import 'components/_lightbox.css';
|
||||
|
||||
/* 4. Page-specific Styles */
|
||||
@import 'pages/_home.css';
|
||||
|
||||
+13
-6
@@ -86,10 +86,17 @@
|
||||
.album-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #D0D5DD; }
|
||||
.album-meta .read-link { color: #2D738C; font-weight: 600; }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.gallery-albums { grid-template-columns: 1fr 1fr; gap: 18px 14px; padding: 24px 16px 72px; }
|
||||
.album-cover { height: 150px; }
|
||||
.album-info { padding: 12px 12px 14px; }
|
||||
.album-info h3 { font-size: 15px; }
|
||||
.cover-more-badge { font-size: 17px; }
|
||||
/* Tablets / large phones: two clear columns */
|
||||
@media (max-width: 768px) and (min-width: 561px) {
|
||||
.gallery-albums { grid-template-columns: 1fr 1fr; gap: 20px 16px; }
|
||||
.album-cover { height: 185px; }
|
||||
}
|
||||
/* Phones: one full-width column so each album reads clearly */
|
||||
@media (max-width: 560px) {
|
||||
.gallery-hero { padding: 44px 20px 32px; }
|
||||
.gallery-albums { grid-template-columns: 1fr; gap: 22px; padding: 22px 16px 64px; }
|
||||
.album-cover { height: 210px; }
|
||||
.album-info { padding: 13px 14px 15px; }
|
||||
.album-info h3 { font-size: 16px; }
|
||||
.cover-more-badge { font-size: 20px; }
|
||||
}
|
||||
Reference in new issue
Block a user