How to activate different sliders on a page when clicking

1

I have 3 banners with photos from 3 different places. I need to click on a figure to activate, in a box, the banner of place 1, then click on another figure to activate, in the same box, the banner of place 2 and so on. Can somebody help me. I tried it with javascript, but it does not work out.

    
asked by Olga L. V. 03.04.2018 в 06:44
source

1 answer

0

I have a jsfiddle that I just made very simple to clarify your ideas.

link

The p inside the div of the slider change it for the images you want.

The javascript code works in the following way, I have a current variable initialized to 1 that tells me that slider is currently being displayed, said variable increases it by 1 each time I press the button (or the figure in your case), I have a data-total to put how many sliders there are in total and thus know when I have reached the end, if the next one is greater than the total, I restart everything to 1.

I think it will be clearer in the jsfiddle that I have gone through, if you have questions ask me.

    
answered by 03.04.2018 / 09:58
source