Merhaba arkadaşlar java script ile bir resim galerisi kurmayaçalışıyorum sayfa açıldığında let slideIndex = 1; çalışmıyor yenilediğimde çalışıyor yada yenilemeden bazen çalışıyor anlayan yardım edebilirmi
window.onload = function exampleFunction() {
let slideIndex = 1;
showSlides(slideIndex);
}


let slideIndex = 1;
showSlides(slideIndex);

function plusSlides(n) {
  showSlides(slideIndex += n);
}

function currentSlide(n) {
  showSlides(slideIndex = n);
}

function showSlides(n) {
  let i;
  let slides = document.getElementsByClassName("mySlides");
  let dots = document.getElementsByClassName("demo");
  let captionText = document.getElementById("caption");
  if (n > slides.length) {slideIndex = 1}
  if (n < 1) {slideIndex = slides.length}
  for (i = 0; i < slides.length; i++) {
    slides[i].style.display = "none";
  }
  for (i = 0; i < dots.length; i++) {
    dots[i].className = dots[i].className.replace(" active", "");
  }
  slides[slideIndex-1].style.display = "block";
  dots[slideIndex-1].className += " active";
  captionText.innerHTML = dots[slideIndex-1].alt;
}
</script>
<script type="text/javascript">
$(document).ready(function(e) {
   
    // live handler
    lc_lightbox('.elem', {
        wrap_class: 'lcl_fade_oc',
        gallery : true,    
        thumb_attr: 'data-lcl-thumb', 
        
        skin: 'minimal',
        radius: 0,
        padding    : 0,
        border_w: 0,
    });    

});