Jump to content
ideasvacuum

Multiple SlideShows on same HTML page

Recommended Posts

I have used this example, embedding the CSS and JS in the HTML file to display one SlideShow:

https://www.w3schools.com/howto/howto_js_slideshow.asp

For multiple SlideShows I have given each a different class name.

.....but I don't know how to add a switch into each slide control function to avoid having a separate set of functions for every SlideShow. 

 

Share this post


Link to post
Share on other sites

You could pass along the SlideShow's ID as an argument. That's the most simple way.

(Instead using separate IDs rather than classes)

Edited by Funce

Share this post


Link to post
Share on other sites

Tried working with IDs but there are so many individual items that need to be independent - could not get my head around it and so I have given each SlideShow item a unique name and each SlideShow has it's own control functions (two functions each)

Share this post


Link to post
Share on other sites

The nearest solution is 

https://www.w3schools.com/code/tryit.asp?filename=FOAHR2CXN2V8

...but because it's structured differently to the w3 example, when I add numbers and captions, they fail.  At the end of the day, I like the way I have done it, based on the w3 example with tweaks (no dots, better prev/next for my site)  because I understand it :)

 

Share this post


Link to post
Share on other sites

You should have done it the other way round, the linked example does not use captions or numbers so "mySlides" and "fade" classes where added to images only. as these classes control the sliding to next image and fade in and out, just adding these to a container div which would hold images, numbered div and caption div as you currently have, would make it work! but as you want till stay with your current method, cause you can understand it! lets leave it that then.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×