Jump to content

vanina

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by vanina

  1. Hi!

    I need some help please  because I  don't know how to change the  javascript code for have more slides in the same page...

    there's somebody that can tell me the right way to do it?...

    I'm using this is code for 2 slides but I need 10 slides  ( from https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_slideshow_multiple)

    <script>
    var slideIndex = [1,1];
    var slideId = ["mySlides1", "mySlides2"]
    showSlides(1, 0);
    showSlides(1, 1);

    function plusSlides(n, no) {
      showSlides(slideIndex[no] += n, no);
    }

    function showSlides(n, no) {
      var i;
      var x = document.getElementsByClassName(slideId[no]);
      if (n > x.length) {slideIndex[no] = 1}    
      if (n < 1) {slideIndex[no] = x.length}
      for (i = 0; i < x.length; i++) {
         x.style.display = "none";  
      }
      x[slideIndex[no]-1].style.display = "block";  
    }
    </script>

     

     

    thank you for your help!

    greetings

×
×
  • Create New...