Trying to follow DRY, but not sure about the way forward.
Essentially, I’m swapping images based upon clicking buttons (with one of the swaps displaying the image on a timer). The code in my Pen seems to work fine.
-OnLoad buttons and an image display
-Click ‘control’ and another image displays
-Click ‘show’ and a timed image displays
-Click ‘stay’ and the same timed image displays and remains
However, I need to display all of that 5 times on a single page (each time using different images). To do so, I’m using tabbed content (not shown in the Pen - it’s working well).
Anyway, I’ve failed at numerous attempts to do this with arrays (one for the buttons and one for the images). This has me wondering if creating objects would be simpler and less repetitive?
I.e., each tab’s content could be an object and the images would be the objects data. The buttons could be an array, outside of the objects.
Now I’m way over my head! Am I nonetheless on the right track?