How to Create a Slideshow in HTML

 | Uncategorized

Here’s the HTML to create a slideshow in HTML – You can personalize it as you wish!

Try our live editor to see the result!

<!DOCTYPE html>

<div name=”box” style=”padding-top: 120px; position: absolute;”>
<img class=”slideshow” style=”width: 60%;” src=””>
<img class=”slideshow” style=”width: 70%;” src=””>
<img class=”slideshow” style=”width: 80%;” src=””>

<div style=”padding-top: 500px; padding-left: 45%; position: absolute;”>
<button style=”width: 30px; height: 30px;” onclick=”changing(-1)”>&#10094;</button>
<button style=”width: 30px; height: 30px;” onclick=”changing(+1)”>&#10095;</button>


var nslide = 1;

function changingsld(n) {
var i;
var x = document.getElementsByClassName(“slideshow”);
if (n > x.length) {nslide = 1}
if (n < 1) {nslide = x.length} ;
for (i = 0; i < x.length; i++) {
x[i].style.display = “none”;
x[nslide-1].style.display = “block”;

function changing (n) {
changingsld(nslide += n);