I have a slideshow displaying some images. There is a function to make the current image displayed fullscreen when clicking it:
var img = document.querySelectorAll(".main-webcam-img")[slideIndex-1];
img.onclick = function () {
modal.style.display = "block";
modalImg.src = img.src;
}
I have prev, next buttons to scroll through the images:
function plusSlides(n) {
showSlides(slideIndex += n);
}
and a function to see what the current slide is:
function currentSlide(n) {
showSlides(slideIndex = n);
}
The problem: When clicking the buttons slideIndexchanges (as it should), but var img = document.querySelectorAll(".main-webcam-img")[slideIndex-1]; doesn`t update.