Apologies for the ambiguous title, as I am struggling to accurately convey the issue I am encountering. To clarify the problem, I have created a jsFiddle.
In my current layout, all four divs have opacity: 1
and visibility: visible
, while divs a and b both have position:absolute
with top: 0
and left: 0
.
<div class="a">
<div class="child-a"></div>
</div>
<div class="b">
<div class="child-b"></div>
</div>
In the provided example, you can change the properties of div b to: opacity: 0
and visibility: hidden
(this transition occurs over time). Once changed, only div a and its child child-a are visible. While you can click on div a, clicking on child-a actually triggers child-b.
Despite the parent of child-b being inactive to mouse events and seemingly invisible, the child itself still responds to them. Ideally, I would expect the child to be completely hidden like its parent.
How can I ensure that clicking on the area where child-a is "seen" applies to child-a as well? I want to utilize opacity transitions between showing and hiding the div, which makes using display:none
impractical for transitioning purposes.
I included the display:none
toggle in the example because it behaves as expected (albeit without any transition effects).