let slideIndex = 1;
showSlides(slideIndex)
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
const slajdovi = document.getElementsByClassName('slajd')
const točke = document.getElementsByClassName('točka');
if (n > slajdovi.length) {slideIndex = 1}
if (n < 1) {slideIndex = slajdovi.length}
for (let i = 0; i < slajdovi.length; i++) {
slajdovi[i].style.display = 'none';
}
for (let i = 0; i < točke.length; i++) {
točke[i].style.backgroundColor = '';
}
slajdovi[slideIndex-1].style.display = "flex";
točke[slideIndex-1].style.backgroundColor = "var(--zlatni-tekst-boja)";
}
I tried tying it to the plusSlides() function but nothing worked, also tried replacing it with the line “slajdovi[i].style.display = ‘none’;” to no avail. Could someone help me? The code is copied off the w3 and currently works as intended but I want it to slide on button click instead of just disappearing and appearing.