<div class="container">
  <div class="color black checked-color"></div>
  <div class="color haki"></div>
  <div class="color orange"></div>
  <img id="black" class="image checked-image" src="https://images.unsplash.com/photo-1507861675166-eed3aff92302?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=9261812cb15177c6ae4ef9c93f9b234b" alt="">
  <img id="haki" class="image" src="https://images.unsplash.com/photo-1519756639815-2075794e800e?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=71609b2585b3a0511c3326f2cfed22ff" alt="">
  <img id="orange" class="image" src="https://images.unsplash.com/photo-1507646227500-4d389b0012be?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=7656360dc78c2c1e47b977eeda8e2850" alt="">
</div>
body
  display: flex
  width: 100%
  height: 100vh
  justify-content: center
  align-items: center
  background-color: #222

.container
  width: 60%

.color
  display: block
  box-sizing: border-box
  width: 30px
  height: 30px
  border-radius: 50%
  border: 1px solid #fff
  margin: 30px 0

.black
  background-color: black

.haki
  background-color: green

.orange
  background-color: orangered

.checked-color
  border: 3px solid #fff

.image
  position: absolute
  width: 400px
  height: 400px
  top: 10%
  left: 50%

.checked-image
  z-index: 10
View Compiled
var container = document.getElementsByClassName('container')[0];
var colors = document.getElementsByClassName('color');
var images = document.getElementsByClassName('image');

function check(event) {
  var target = event.target;
  for (var i = 0; i < colors.length; i++) {
    colors[i].classList.remove('checked-color');
  };
  target.classList.add('checked-color');
  var color = target.classList[1];
  for (var j = 0; j < images.length; j++) {
    images[j].classList.remove('checked-image');
  };
  if (color == 'black') {
    black.classList.add('checked-image');
  } else if (color == 'haki') {
    haki.classList.add('checked-image');
  } else if (color == 'orange') {
    orange.classList.add('checked-image');
  };
};

container.addEventListener('click', check);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.