Repeater into an automatic image slider

I currently have a repeater with 4 items in it, it is connected to a dataset in the content manager but it doesn’t have to be if for coding sake it would make it easier. Are there any suggestions on how I would create a function to display each item one at a time on a timed interval.

I initially tried running a setTimeout with my loadSlider function and have it running on a 6 second interval. I need help writing the function to properly cycle through each item in the repeater because I am having issues with mine, I have it working to an extent. Any help would be greatly appreciated!

It depends on what exactly you need.
for example, whether or not need some animation etc…
anyway if all you need is switching the image, you actually don’t need a repeater at all (you only show 1 image at a time.
Set interval (use setInerval() not setTimeout() ) and replace the image.src in a loop.

@jonatandor35 I managed a work around but I will have to try this, I knew I was overcomplicating it, but I initially wanted to see how I could cycle through a dataset and show the different items in the dataset on an interval. Anyway, this is great, thanks so much!(again)