I have 2 divs that are different sizes, D1 and D2. when hovering over D1 I want D2 to become visible, and D1 to come back when the user moves off. So D2 should replace D1 when the user hovers.
If you try the jsFiddle, you'll see the problem. The blocks flash and D2 never becomes visible.
.wrapper {
position: relative;
}
#inBack {
position: absolute;
top: 0;
right: 0;
}
#inFront :hover {
display:none;
}
#inBack :hover {
display:block;
}
<div class="wrapper" >
<div id="inFront" style="background-color:red;" class="navi">
<h2>
header of item in front
</h2>
<text>
<p>body of item in front</p>
<p>body of item in front</p>
</text>
</div>
<div id="inBack" style="background-color:green; display:none;" >
<h2>
header of item in back
</h2>
<text>
<p>body of item in back</p>
<p>body of item in back</p>
<p>body of item in back</p>
<p>body of item in back</p>
<p>body of item in back</p>
<p>body of item in back</p>
</text>
</div>
</div>
<div style="background-color:cyan;">
<p>
This part should be pushed down to make way for the larger text
</p>
</div>
Do I need javascript for this?