When I hover over an img within div.hover-group, the div div.hover-toggle becomes visible, and becomes invisible when the mouse leaves the image.
The div.hover-toggle should appear within the area of the img it belongs to, aligned with its bottom border and each of the button.btns of equal width.
To illustrate:
no mouseover:
|-----------|
| |
| img |
| |
| |
| |
|-----------|
is mouseover:
|-----------|
| |
| img |
| |
|-----------|
| 1 | 2 | 3 |
|-----------|
I have already accomplished the hover toggling using jQuery:
$(selector1).mouseover(function(){$(selector2).hide();});
$(selector1).mouseout(function(){$(selector2).show();});
However, have been unable to align div.hover-toggle with the bottom of the image, as illustrated, it appears below the image instead.
How can this be done?
Thanks!
The DOM I am manipulating above appears below. It uses twitter bootstrap.
<ul class="thumbnails">
<li class="span3">
<div class="hover-group thumbnail">
<img src="http://placehold.it/260x180" alt="">
<div class="hover-toggle btn-group">
<button class="btn">1</button>
<button class="btn">2</button>
<button class="btn">3</button>
</div>
<h5>Thumbnail label</h5>
<p>Thumbnail caption right here...</p>
</div>
</li>
...
</ul>
There is no need for JS here, you can accomplish everything with simple CSS and a little markup change (I wrapped the image and the .hover-toggle div in a .image-wrapper div):
Now the styling it needs is simple:
If you want it to show when you hover over the whole .hover-group, use this CSS instead of the last line: