var modal = document.getElementById(„modal“);
var modalImg = document.getElementById(„img01“);
var captionText = document.getElementById(„caption“);
var currentIndex = 0;
var images = document.getElementsByClassName(‚gallery-image‘);
function setModalImage(index) {
modal.style.display=“block“;
modalImg.src=images[index].src;
captionText.innerHTML=images[index].alt;
currentIndex=index;
}
for (var i = 0; i < images.length; i++) {
letindex=i;
images[i].onclick=function() {
setModalImage(index);
}
}
function plusSlides(n) {
varnewIndex=currentIndex+n;
if (newIndex<0) {
newIndex=images.length-1;
} else if (newIndex >= images.length) {
newIndex=0;
}
setModalImage(newIndex);
}
var span = document.getElementsByClassName(„close“)[0];
span.onclick = function() {
modal.style.display=“none“;
}