+ 1

Please I need help with my code. I have been trying to create multiple automatic slideshow on the same page with Javascript.

I tried using the following code. var slideIndex = [1,1,1,1,1]; var dotId = ["dot1", "dot2", "dot3", "dot4", "dot5"]; var slideId = ["mySlides1", "mySlides2", "mySlides3", "mySlides4", "mySlides5"] showSlides(1, 0); showSlides(1, 1); showSlides(1, 2); showSlides(1, 3); showSlides(1, 4); function showSlides(n, no) { var i; var x = document.getElementsByClassName(slideId[no]); var dots = document.getElementsByClassName(dotId[no]); for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } slideIndex[n]++; if (slideIndex[no] > x.length) {slideIndex = 1} for (i = 0; i < dots.length; i++) {    dots[i].className = dots[i].className.replace(" active", ""); } x[slideIndex[no]-1].style.display = "block"; dots[slideIndex[no]-1].className += " active"; setTimeout(showSlides, 2000); }

31st Mar 2020, 4:09 PM
Em Jey!
Em Jey! - avatar
3 Answers
+ 12
I know what he is asking. I was going to ask the same thing, but I used the searchbar. I also want to program two automatic slideshows in parallel. I figured out one way to do it, but I want to reduce my redundant code. Do you know how to program two automatic slideshows in parallel on the same webpage?
21st Jul 2020, 6:09 PM
Uri Easter
Uri Easter - avatar
22nd Aug 2020, 7:04 PM
Uri Easter
Uri Easter - avatar
+ 2
Please show you whole code in you account. What is your question?
31st Mar 2020, 4:27 PM
JaScript
JaScript - avatar