fix: add gallery exists check

This commit is contained in:
Matthieu Bessat 2020-08-19 11:56:38 +02:00
parent d29d1a0212
commit 014e51640c

View file

@ -164,16 +164,18 @@ let closeModal = () => {
} }
} }
navLeft.onclick = () => { if (document.querySelector('.media-mosaic') != null) {
if (mediaData.indexOf(currentMedia) === 0) { return; } navLeft.onclick = () => {
currentMedia = mediaData[mediaData.indexOf(currentMedia) - 1] if (mediaData.indexOf(currentMedia) === 0) { return; }
fillModal() currentMedia = mediaData[mediaData.indexOf(currentMedia) - 1]
} fillModal()
}
navRight.onclick = () => { navRight.onclick = () => {
if (mediaData.indexOf(currentMedia) + 1 === mediaData.length) { return; } if (mediaData.indexOf(currentMedia) + 1 === mediaData.length) { return; }
currentMedia = mediaData[mediaData.indexOf(currentMedia) + 1] currentMedia = mediaData[mediaData.indexOf(currentMedia) + 1]
fillModal() fillModal()
}
} }
/** /**