0

I'm new to this but managed the following. How do I start it over after user has clicked through three images?

<button onclick="slideSwitch()">Click me</button>

<div id="slideshow">
    <img src="image1.jpg" style="position:absolute;" class="active" />
    <img src="image2.jpg" style="position:absolute;" />
    <img src="image3.jpg" style="position:absolute;" />
</div>


   function slideSwitch() {
        var $active = $('div#slideshow IMG.active');
        var $next = $active.next();    
    $next.addClass('active');

    $active.removeClass('active');
}
NJeffries
  • 95
  • 2
  • 9
  • You might also find this useful: [jQuery $.next() & $.prev() with wrapping](https://www.darklaunch.com/2013/08/06/jquery-next-prev-with-wrapping) – showdev May 26 '16 at 18:11
  • Here's another similar SO post: [jQuery, next, prev, cycling to first and last](http://stackoverflow.com/questions/15815085/jquery-next-prev-cycling-to-first-and-last) – showdev May 26 '16 at 18:28

0 Answers0