Gallery: distinct album cards, blue tint, hover lift, whole card links to story
- Each album is now a bordered card with a resting shadow and clear separation - Blue brand tint over the cover photos; fades on hover so images brighten - Whole card lifts with a stronger shadow on hover (album-level, not per image) - Clicking anywhere on a card opens the event story page (removed the lightbox) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d048226daf
commit
24c77e6171
5 files changed
+345
-515
No files matched your search
@@ -833,60 +833,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ===================================================================
|
||||
* GALLERY LIGHTBOX (per-album photo viewer)
|
||||
* ===================================================================
|
||||
*/
|
||||
function setupGallery() {
|
||||
var lb = document.getElementById('gallery-lightbox');
|
||||
if (!lb) return;
|
||||
var img = lb.querySelector('.lightbox-img');
|
||||
var cap = lb.querySelector('.lightbox-caption');
|
||||
var group = [];
|
||||
var idx = 0;
|
||||
|
||||
function render() {
|
||||
var it = group[idx];
|
||||
img.setAttribute('src', it.full);
|
||||
img.setAttribute('alt', it.caption || '');
|
||||
cap.textContent = (it.caption || '') + (group.length > 1 ? ' (' + (idx + 1) + '/' + group.length + ')' : '');
|
||||
}
|
||||
function open(grid, start) {
|
||||
group = Array.prototype.map.call(grid.querySelectorAll('.gallery-thumb'), function (b) {
|
||||
return { full: b.getAttribute('data-full'), caption: b.getAttribute('data-caption') || '' };
|
||||
});
|
||||
idx = start;
|
||||
render();
|
||||
lb.classList.add('is-open');
|
||||
lb.setAttribute('aria-hidden', 'false');
|
||||
document.documentElement.style.overflow = 'hidden';
|
||||
}
|
||||
function close() {
|
||||
lb.classList.remove('is-open');
|
||||
lb.setAttribute('aria-hidden', 'true');
|
||||
document.documentElement.style.overflow = '';
|
||||
img.setAttribute('src', '');
|
||||
}
|
||||
function step(d) { idx = (idx + d + group.length) % group.length; render(); }
|
||||
|
||||
document.querySelectorAll('.gallery-grid').forEach(function (grid) {
|
||||
grid.querySelectorAll('.gallery-thumb').forEach(function (btn, i) {
|
||||
btn.addEventListener('click', function () { open(grid, i); });
|
||||
});
|
||||
});
|
||||
lb.querySelector('.lightbox-close').addEventListener('click', close);
|
||||
lb.querySelector('.lightbox-prev').addEventListener('click', function () { step(-1); });
|
||||
lb.querySelector('.lightbox-next').addEventListener('click', function () { step(1); });
|
||||
lb.addEventListener('click', function (e) { if (e.target === lb) close(); });
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (!lb.classList.contains('is-open')) return;
|
||||
if (e.key === 'Escape') close();
|
||||
else if (e.key === 'ArrowLeft') step(-1);
|
||||
else if (e.key === 'ArrowRight') step(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ===================================================================
|
||||
* HUB USE-CASE CAROUSEL (auto-scrolling)
|
||||
@@ -917,6 +863,5 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
setupLanguageSuggestion();
|
||||
setupNewsletter();
|
||||
setupHubCarousel();
|
||||
setupGallery();
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user