I have two div blocks of different color. I want to change color of the second block if it overlays the other one on more then 80%, using JavaScript!!!. Here is my code. Result - https://i.stack.imgur.com/HDcm4.png
Here's my code:
.FirstBlock{
    height: 100px;
    width: 100px;
    border: 1px solid black;
    background-color: green;
    opacity: 0.8;
}
.SecondBlock{
    height: 100px;
    width: 100px;
    border: 1px solid black;
    margin-top: -25px;
    background-color: red;
    opacity: 0.8;
}<body>
    <div class="FirstBlock"></div>
    <div class="SecondBlock"></div>
</body> 
     
     
    