I have 4 elements <div>
where they have a component that only appears when the user hover over <div>
container
(which has class="thumbanil"
) but when mouse over the hidden contents o even if it is visible, this behavior should not happen because where the hidden content is, it is positioned to the other <div>
container (this has class="thumbanil"
).
How it should stay: Content that is hidden should be displayed only when the mouse passes over <img>
thumbnail and remains visible as long as the mouse is over <div>
container
( which has class="thumbanil"
).
What I already did (but did not work): I made the hidden element visible only when the mouse moves over the thumbnail but as soon as the mouse exits the thumbnail to enter the content hidden
hidden content (now visible) was hidden again, so I went back to the previous one of the code.HTML code:
<div class="col-md-8 section span7 text-center">
<div class="thumbnail">
<img src="assets/images/projetos/thumbnail.png" alt="Site Pessoal">
<div class="caption">
<p><strong>Site</strong></p>
<p>
<a href="#" class="btn btn-info gray gly_medium" id="site-imagens" title="Veja imagens">
<span class="glyphicon glyphicon-search"></span>
</a>
<a href="#" class="btn btn-info gray gly_medium" title="Acesse o site">
<span class="glyphicon glyphicon-link"></span>
</a>
</p>
</div>
</div>
<div class="thumbnail">
<img src="assets/images/projetos/thumbnail.png" alt="Video Site">
<div class="caption">
<p><strong>Video Content Site</strong></p>
<p>
<a href="#" class="btn btn-info gray gly_medium" id="video-imagens" title="Veja Imagens">
<span class="glyphicon glyphicon-search"></span>
</a>
<a href="#" class="btn btn-info gray gly_medium" title="Acesse o site">
<span class="glyphicon glyphicon-link"></span>
</a>
</p>
</div>
</div>
<div class="thumbnail">
<img src="assets/images/projetos/thumbnail.png" alt="Video Site">
<div class="caption">
<p><strong>Video Site</strong></p>
<p>
<a href="#" class="btn btn-info gray gly_medium" id="video-imagens" title="Veja Imagens">
<span class="glyphicon glyphicon-search"></span>
</a>
<a href="#" class="btn btn-info gray gly_medium" title="Acesse o site">
<span class="glyphicon glyphicon-link"></span>
</a>
</p>
</div>
</div>
<div class="thumbnail">
<img src="assets/images/projetos/thumbnail.png" alt="Video Site">
<div class="caption">
<p><strong>Video Site</strong></p>
<p>
<a href="#" class="btn btn-info gray gly_medium" id="video-imagens" title="Veja Imagens">
<span class="glyphicon glyphicon-search"></span>
</a>
<a href="#" class="btn btn-info gray gly_medium" title="Acesse o site">
<span class="glyphicon glyphicon-link"></span>
</a>
</p>
</div>
</div>
</div>
CSS Code:
.thumbnail{
display:inline-block
}
.caption{
opacity:0;
transition:opacity .5s;
position:absolute;
background-color:#fff;
width:308px;
margin-left:-5px
}
.thumbnail:hover .caption{
opacity:1;
z-index:1
}
Image that demonstrates the defect:
The red arrow is in the place of the mouse, notice that the mouse is (apparently) on top of the <div>
thumbnail below but is actually above caption
.
Exampleon FIDDLE , generated by user @IsraelSousa.