Next & Preview Buttons for Multi-State-Box (Velo)

HI, Thanks for your reply.

I like to have a slideshow for my hero section und 2 buttons to switch between the states. I saw this video here and he is using the code below to set a timer to change states.

In the comments someone asked him if its possible to get a next and preview button and he said yes.

“You can use any trigger in order to change states.For click you can use the following:$w(‘ #nextButton ’).onClick(() => { ….changeState function……})”

…I don’t get it.

$w.onReady(function () {
    var states = ['state1', 'state2', 'state3'];
    var stateNumber = 0;

    function slideShow() {
        $w('#multiStateBox1').changeState(states[stateNumber]);
        if (stateNumber < states.length - 1) {
            stateNumber++;
        } else {
            stateNumber = 0;
        }
        setTimeout(slideShow, 6000);
    }
    slideShow();
});