When the user scrolls through the ".all" div, I have a main div in the header and need to calculate the distance between 2 other divs. If the current "elems" div is only partially visible on the screen, I want to hide it.
.main {
width: 500px;
height: 100px;
border: 1px solid;
float: left;
clear: both;
}
.all {
float: left;
clear: both;
width: 500px;
height: 500px;
border: 1px solid #ff0000;
overflow: auto;
}
.elems {
width: 400px;
height: 200px;
border: 1px solid #c0c0c0;
}
<div class="main"></div>
<div class="all"><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div class="elems"></div>
<div>
Take a look at this screenshot for reference: https://i.sstatic.net/YjcVR.png