I am trying to replicate Cargo’s image gallery scrub using my own HTML/CSS and/or Java. Example of what I want here on image click: https://sage-smith.com/. It is similar to this stack thread (which worked in my code): how to change image onclick javascript function?
However, this solution only offers to click between 2 images. I am trying to do it with multiple images (like an image gallery).
This is what I have so far:
HTML
<a><img src="collage3.jpg" id="changer" onclick="changeImage(this)"/></a>
Javascript
function changeImage(element) {
element.src = element.bln ? "collage3.jpg" : "asset-2.png";
element.bln = !element.bln; /* assigns opposite boolean value always */
}