Hi,
I added one little functionality, when you click on previous button and first slide is active carousel crashes, so I add this code in prevSlide function
if (currentSlide > 0) { currentSlide = (currentSlide - 1) % slides.length; } else { currentSlide = slides.length - 1; }
Also added a setInterval for continuous repeat of slides. Nice tutorial btw... Cheers... :)
Awesome, thanks
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi,
I added one little functionality, when you click on previous button and first slide is active carousel crashes, so I add this code in prevSlide function
if (currentSlide > 0) {
currentSlide = (currentSlide - 1) % slides.length;
} else {
currentSlide = slides.length - 1;
}
Also added a setInterval for continuous repeat of slides.
Nice tutorial btw...
Cheers... :)
Awesome, thanks