Line 28: | Line 28: | ||
// Get the element with id="defaultOpen" and click on it | // Get the element with id="defaultOpen" and click on it | ||
document.getElementById("defaultOpen").click(); | document.getElementById("defaultOpen").click(); | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | 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"; | ||
+ | } | ||
</script> | </script> | ||
Line 72: | Line 96: | ||
<body> | <body> | ||
+ | |||
+ | <img class="mySlides" src="img_snowtops.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> | ||
+ | |||
+ | |||
<br><br><br><br><br> | <br><br><br><br><br> | ||
<br><br><br><br><br> | <br><br><br><br><br> |
Revision as of 14:36, 17 October 2018