change bg colour on hover with real code

by ian_smithz

HTML

<div id="trigger"></div>


<div class="maskholder"></div>



<div id="bg"></div>

CSS

body {
  height: 100%;
}

#trigger {
  position: absolute;
  width: 200px;
  height: 136px;
  top: 50%;
  left: 50%;
  margin: -68px 0 0 -100px;
  background: red;
  z-index: 2;
}

.maskholder {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #EEE;
}

#trigger:hover ~ .maskholder {
  background: rgba(0, 0, 0, 0.8);
}

JavaScript

// Background change on div hover