Created
June 11, 2019 08:25
-
-
Save huyhoang8398/59956c1a75a99b477841966909e9a8a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slideIndex = 1; | |
showSlides(slideIndex); | |
function plusSlides(n) { | |
showSlides(slideIndex += n); | |
} | |
function currentSlide(n) { | |
showSlides(slideIndex = n); | |
} | |
function showSlides(n) { | |
var i; | |
var slides = document.getElementsByClassName("mySlides"); | |
var dots = document.getElementsByClassName("dot"); | |
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"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment