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 (mediaData.indexOf(currentMedia) === 0) { return; }
currentMedia = mediaData[mediaData.indexOf(currentMedia) - 1]
fillModal()
}
if (document.querySelector('.media-mosaic') != null) {
navLeft.onclick = () => {
if (mediaData.indexOf(currentMedia) === 0) { return; }
currentMedia = mediaData[mediaData.indexOf(currentMedia) - 1]
fillModal()
}
navRight.onclick = () => {
if (mediaData.indexOf(currentMedia) + 1 === mediaData.length) { return; }
currentMedia = mediaData[mediaData.indexOf(currentMedia) + 1]
fillModal()
navRight.onclick = () => {
if (mediaData.indexOf(currentMedia) + 1 === mediaData.length) { return; }
currentMedia = mediaData[mediaData.indexOf(currentMedia) + 1]
fillModal()
}
}
/**