Skip to content

Instantly share code, notes, and snippets.

@maagmirror
Created September 10, 2019 15:21
Show Gist options
  • Save maagmirror/3823f2db475560bf2482a419209b9cd3 to your computer and use it in GitHub Desktop.
Save maagmirror/3823f2db475560bf2482a419209b9cd3 to your computer and use it in GitHub Desktop.
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[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment