|
@@ -111,15 +111,15 @@
|
|
|
lbIndex = index || 0;
|
|
lbIndex = index || 0;
|
|
|
updateLightbox();
|
|
updateLightbox();
|
|
|
const lb = document.getElementById('lightbox');
|
|
const lb = document.getElementById('lightbox');
|
|
|
- lb.classList.remove('hidden');
|
|
|
|
|
- lb.classList.add('flex');
|
|
|
|
|
|
|
+ lb.style.display='flex';
|
|
|
|
|
+
|
|
|
document.body.style.overflow = 'hidden';
|
|
document.body.style.overflow = 'hidden';
|
|
|
}
|
|
}
|
|
|
function closeLightbox(e) {
|
|
function closeLightbox(e) {
|
|
|
if (e && e.target.tagName === 'IMG') return;
|
|
if (e && e.target.tagName === 'IMG') return;
|
|
|
const lb = document.getElementById('lightbox');
|
|
const lb = document.getElementById('lightbox');
|
|
|
- lb.classList.add('hidden');
|
|
|
|
|
- lb.classList.remove('flex');
|
|
|
|
|
|
|
+ lb.style.display='none';
|
|
|
|
|
+
|
|
|
document.body.style.overflow = '';
|
|
document.body.style.overflow = '';
|
|
|
}
|
|
}
|
|
|
function navigateLightbox(dir, e) {
|
|
function navigateLightbox(dir, e) {
|
|
@@ -135,7 +135,7 @@
|
|
|
document.getElementById('lb-next').classList.toggle('hidden', lbImages.length <= 1);
|
|
document.getElementById('lb-next').classList.toggle('hidden', lbImages.length <= 1);
|
|
|
}
|
|
}
|
|
|
document.addEventListener('keydown', e => {
|
|
document.addEventListener('keydown', e => {
|
|
|
- if (document.getElementById('lightbox').classList.contains('hidden')) return;
|
|
|
|
|
|
|
+ if (document.getElementById('lightbox').style.display === 'none' || document.getElementById('lightbox').style.display === '') return;
|
|
|
if (e.key === 'ArrowLeft') navigateLightbox(-1);
|
|
if (e.key === 'ArrowLeft') navigateLightbox(-1);
|
|
|
else if (e.key === 'ArrowRight') navigateLightbox(1);
|
|
else if (e.key === 'ArrowRight') navigateLightbox(1);
|
|
|
else if (e.key === 'Escape') closeLightbox(e);
|
|
else if (e.key === 'Escape') closeLightbox(e);
|