Jump to content

Creating multiple slideshow galleries


Gexuma
 Share

Recommended Posts

I've been using a gallery based on this tutorial https://www.w3schools.com/howto/howto_js_slideshow_gallery.asp, and it works pretty well, but now I've tried to put two on one page and discovered that this doesn't work, as the variables become shared by both. This leads to them not being independent of one another. I've been trying to figure out a way to do this without creating new sets of variables and classes for each new slideshow on the same page, but I've had no luck. How would I go about efficiently making multiple slideshows?

Link to comment
Share on other sites

Please post the relevant part of your code.  Else, we'd just be guessing.

Edited by niche
Link to comment
Share on other sites

There's no need to show the code that he wrote, it's the code that is on the tutorial page: https://www.w3schools.com/howto/howto_js_slideshow_gallery.asp

The topic is asking how to put two of them on the page at the same time without duplicating the Javascript.

I've answered this one already. The problem can be solved by attaching events using Javascript instead of as an HTML attribute.

 

  • Thanks 1
Link to comment
Share on other sites

Didn’t know you already answered the question.  I thought they altered the code based on the tuit.

Link to comment
Share on other sites

On 5/21/2021 at 11:58 AM, Ingolme said:

There's no need to show the code that he wrote, it's the code that is on the tutorial page: https://www.w3schools.com/howto/howto_js_slideshow_gallery.asp

The topic is asking how to put two of them on the page at the same time without duplicating the Javascript.

I've answered this one already. The problem can be solved by attaching events using Javascript instead of as an HTML attribute.

 

Thanks for the answer, I'll give that a go.

Link to comment
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
 Share

×
×
  • Create New...