How to use JS to determine the real visibility of an element?
For example, there is the following demo
.red{
width: 100px;
height: 100px;
left: 20px;
top: 20px;
background: red;
position: absolute;
}
.blue{
width: 50px;
height: 50px;
left: 60px;
top: 60px;
background: blue;
position: absolute;
}
.green{
width: 100px;
height: 100px;
left: 50px;
top: 50px;
background: green;
position: absolute;
}
<div class='red'></div>
<div class='blue'></div>
<div class='green'></div>
How can I check that the "blue" element is not visible on the screen? Is there a way to determine the real visibility of an element at a given time to the human eye? Same question with z-index. checking all elements and comparing which z-index is not an option, of course, and the elements can be in different positions.