How to change the color of a item in a gallery

I’m trying to find out how to have a item change color when clicking different colors button.

Some thing like in the following site

Read More

http://www.imprintablefashion.com/cgi-bin/brand/site.w?location=olc/cobrand-product.w&category=3&prb=&srb=&mill=&shade=&color=&product=8398&frames=no&target=main&sponsor=004974&nocache=77902

I’m using WordPress. If anyone can point me to the right direction that would be great. Any

idea of examples would be greatly appreciated.

Related posts

Leave a Reply

1 comment

  1. You actually need to have several images. Each time you press on item/button, you will change the image in the image place holder in your HTML to the desired one.

    // JS
    function changeImg()
    { 
        // some logic like swicth to select the image
        document.getElememtById("image_cont").innerHTML = "<img src='" + some_image + "'/>";
    }
    // Html
    <div id="image_cont"></div>
    <button onclick="changeImg()">Change the Image</button>
    
    // so on
    

    Then you can use some logic in your function to select the image you desire.