2
I have 4 elements <div>
where they have a component that is only displayed when the user hovers over the <div>
container
(the one that has class="thumbanil"
) however when I move the mouse over the hidden content the same becomes visible, this behavior should not happen because where the hidden content is positioned the other <div>
container (this one has class="thumbanil"
).
How it should look: Content that is hidden should only be displayed when the mouse hovers over the <img>
thumbnail and remain visible while the mouse is over the <div>
container
(the one that has class="thumbanil"
).
What I’ve done (but it didn’t work): I made the hidden element only visible when the mouse passed over the thumbnail but once the mouse left the thumbnail to enter the hidden content the hidden content (now visible) was hidden again, soon I returned 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 showing the defect:
The red arrow is in place of the mouse, note that the mouse is (apparently) on top of the thumbnail of <div>
below but is really upon the caption
.
Example in FIDDLE, generated by user @Israelsousa.
Can you play this in jsFiddle? I don’t see any div
container
in your HTML.– Sergio
the div container is this with
class="thumbanil"
I will be more specific in the question.– Ricardo
I don’t quite understand what you want to do, I tested it here on a jsfidle and it’s working the way you want it to if that’s what I understand. https://jsfiddle.net/hk3ynf0p/
– Israel Sousa
The Hover is showing up while you have the mouse positioned over the item.
– Israel Sousa
@Israelsousa note that when you hover over the top of the image the hidden content of
div
superior. this should not happen.– Ricardo
For me the behavior is the same regardless of what part of the image the mouse does Hover... isn’t that so for you? which browser you use?
– Sergio
When I do the
<div class="caption">
she is visible but she is hidden beneath another<div>
and when I step or mouse over the top of the<div>
this below is displayed the capition of the upper div, ex: in the fiddle pass the mouse at the top of the image of the crab, is displayed thecaption
of the Thunderbird image. Make the fiddle have a small size, so there is a line break and have a div on the other– Ricardo
I understood, when the mouse points to the <p> or <Strong> it appears, when what he wanted was only when he pointed to the image. Try this: . caption:Hover{ display:None; }
– Israel Sousa
Ok, with the line break I already noticed the problem. Soluciona juntando visibility Hidden/Visible? -> https://jsfiddle.net/hk3ynf0p/2/
– Sergio
@Sergio Sim worked.
– Ricardo
@Sergio, had already validated Fernando’s solution almost at the same time, post his answer so he can give you the 10 rep points. and for other users to see it in the future.
– Ricardo
@Ricardohenrique, I think I’ve found a better solution response issue.
– Fernando Leal