Search code examples
javascriptjquerycyclejquery-cycle

Return to the first "slide" based on an event with jQuery Cycle


I'm using the jQuery Cycle plugin and I can find no way to return to the first slide/image via its documentation.

Is there a way to do this programmatically? For example, say you're on slide 4, and there is a DIV with a jQuery.click() event... how would you bind that event to return you to the first slide?


Solution

  • You did not look at the demos. Have a look at the Goto demo:

    $('#s1').cycle();
    $('#goto1').click(function () {
        $('#s1').cycle(0);
        return false;
    });
    

    Demo here

    I would recommend switching to cycle2 instead. You do not know what you are missing.