Hi, I’m trying to create my own image slider with css and javascript. All is going well but my code is not looping…
It goes through all the images once and then stop at the last image, it does not reset back to the first image.

function test2() {
(function() {
    var rotator = document.getElementsByName("slide_switch");
    var delayInSeconds = 5;
    var num = 0;
    var len = rotator.length;
    num = (num === len) ? 0 : ++num; //reset if last image reached 
    }, delayInSeconds * 1000);
Any help will be valued thanks