I have a coding project involving changing images in an array. I've successfully set up the automatic image change, but now I want to customize the timing between each image transition. The code is being written in Dreamweaver.
Here's the current code snippet:
<!DOCTYPE html>
<html>
<body>
<img src="image1.png" width="74" height="208" id="image1">
<br>
<button onclick="clearInterval(MyVar)">Stop Sequence</button>
<script>
MyVar = setInterval(ChangeImages, 1000)
function Start() {
myVar = setInterval(ChangeImages, 1000)
}
var Images = ["image1.png", "image2.png","image3.png","image4.png"];
var image = document.getElementById("image1");
function ChangeImages()
{
if (image1.src.match(Images[0]))
{
image.src = Images[1];
} else if (image1.src.match(Images[1]))
{
image.src = Images[2];
} else if (image1.src.match(Images[2]))
{
image.src = Images[3];
} else if (image1.src.match(Images[3]))
{
image.src = Images[0];
}
}
</script>
<br>
<Button onclick="Start() ">Resume</button>
</body>
</html>
Any assistance on how to adjust the timing would be highly appreciated.
Thank you!