dalton319 Posted November 8, 2022 Share Posted November 8, 2022 Hi, I am following the tutorial here to create multiple slide shows on my single page site. - getting to grips with JS https://www.w3schools.com/howto/howto_js_slideshow.asp It says i need to add a customer class to each slideshow slide1, slide2, etc I wish to add a 3rd, and cant seem to get it working. is there anything i need other then the below to get this to work, let slideIndex = [1,1];/* Class the members of each slideshow group with different CSS classes */let slideId = ["mySlides1", "mySlides2", mySlides3]showSlides(1, 0);showSlides(1, 1);function plusSlides(n, no) { showSlides(slideIndex[no] += n, no);}function showSlides(n, no) { let i; let x = document.getElementsByClassName(slideId[no]); if (n > x.length) {slideIndex[no] = 1} if (n < 1) {slideIndex[no] = x.length} for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } x[slideIndex[no]-1].style.display = "block";} Any help will be most appreciated, thanks for your time. Link to comment Share on other sites More sharing options...
dsonesuk Posted November 13, 2022 Share Posted November 13, 2022 Add third element to index to match number slideshows, third slideshow should be as quoted text as it will be treated as non existing variable. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now