Document.getElementFromPoint () for the private item

After doing some research, I came across a method document.getElementFromPoint(x,y), and that is almost what I want, except that I do not need the topmost element.

Pretend I said markup:

<div id="top"></div>
<div id="bottom"></div>

with this CSS:

div { 
    position: absolute;
    top: 0;
    left: 0;
    height: 50px;
    width: 50px;
}
#top {
    z-index: 1;
}
#bottom {
    z-index: 0;
}

In this case, execution document.getElementFromPoint(0,0)will return <div id="top"></div>.

What interests me is if there is a moderately simple (without plugins) way to aim at #bottomthrough the cursor point.

+3
source share

All Articles