Jump to content

TSmooth40

Members
  • Content Count

    6
  • Joined

  • Last visited

Posts posted by TSmooth40


  1. From W3.CSS Slideshow webpage: http://www.w3schools.com/w3css/w3css_slideshow.asp.

     

    Is there a way where I can utilize both the manual and automatic script within a single slideshow?

    I want the slideshow to move automatically as well as have the capability to change the slides manually.

    Thanks you for your assistance.

     

    var slideIndex = 1;
    showDivs(slideIndex);


    function plusDivs(n) {
    showDivs(slideIndex += n);
    }


    function showDivs(n) {
    var i;
    var x = document.getElementsByClassName("mySlides");
    if (n > x.length) {slideIndex = 1}
    if (n < 1) {slideIndex = x.length} ;
    for (i = 0; i < x.length; i++) {
    x.style.display =
    "none";
    }
    x[slideIndex-
    1].style.display = "block";
    }

     

    var slideIndex = 0;
    carousel();


    function carousel() {
    var i;
    var x = document.getElementsByClassName("mySlides");
    for (i = 0; i < x.length; i++) {
    x.style.display =
    "none";
    }
    slideIndex++;
    if (slideIndex > x.length) {slideIndex = 1}
    x[slideIndex-
    1].style.display = "block";
    setTimeout(carousel,
    2000); // Change image every 2 seconds
    }

×
×
  • Create New...