Manual Slideshow

Give your users control. A simple gallery script with Next/Back buttons.

Copy the Script

<script>
var slides = ["photo1.jpg", "photo2.jpg", "photo3.jpg"];
var index = 0;

function changeSlide(direction) {
  index += direction;
  if (index < 0) index = slides.length - 1;
  if (index >= slides.length) index = 0;
  document.getElementById("myImage").src = slides[index];
}
</script>

<img id="myImage" src="photo1.jpg" width="400">
<br>
<button onclick="changeSlide(-1)">Prev</button>
<button onclick="changeSlide(1)">Next</button>