Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <img class="mySlides" src="img_fjords.jpg">
- <img class="mySlides" src="img_lights.jpg">
- <img class="mySlides" src="img_mountains.jpg">
- <img class="mySlides" src="img_forest.jpg">
- <button class="w3-button w3-display-left" onclick="plusDivs(-1)">❮</button>
- <button class="w3-button w3-display-right" onclick="plusDivs(+1)">❯</button>
- 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";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement