var myShow = w3.slideshow(".nature", 0); The slideshow object contain properties and methods, such as next () and previous (): Example <button onclick="myShow.previous ()"> Previous </button> <button onclick="myShow.next ()"> Next </button> You need to make sure that you capture the integer that is returned from your timer: So that you can cancel the timer where appropriate: You will want to clear your timer upon the clicking of the button, which will stop the automatic one from running and then you can start a new one, leaving you with only one running timer. We calculate which "radio" button the user clicked. Then, setInterval () is employed to iterate over the images at a pace of every 5 seconds. This is the code for automatic slide show. We'll start by putting all of our elements on screen. How to modify this to work with buttons. Can an adult sue someone who violated them as a child? I have to make a slideshow that has to work both automatic and manual. Add the setInterval() function in your example reference link after the below line: var slideIndex = 1; Stack Overflow for Teams is moving to its own domain! You did not declare the functions to make slider move on button click . Unflagging anobjectisa will restore default visibility to their posts. To do that, define a variable called i outside the setInterval method with an initial value of 0. let i = 0; Then, get the first image from the images array using the i variable and make it visible by setting the style.display to block. Add a group of slides to the slideshow. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, Javascript and CSS for Automatic Slideshow, Going from engineer to entrepreneur takes more than just good code (Ep. 503), Fighting to balance identity and anonymity on the web(3) (Ep. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, @CommercialSuicide, I wouldn't recommend that - especially when working with numbers or any kind of type that might have a value that is falsy (e.g., 0, ''), as.