The image tag in my .HTML file looks like this:
<img id="xyz"/>
Within the JavaScript portion, I have the following code:
let i = 1;
let images = ["src1", "src2", "src3", "src4", "src5"];
let imgDiv = document.getElementById('xyz');
imgDiv.src = images[0];
setInterval(() => {
momentDiv.src = images[i];
i++;
if(i == images.length) i=0;
}, 5000);
The image within imgDiv is now switching every 5 seconds.
How can I add animation or transition to the image when the "src" property changes?
Please provide a solution without using jQuery.