As long as the image you want to highlight is sibling or descendant of the item you're hovering over, it can be done relatively easily.
Siblings
<div>
<img class="thumbnail" src="path/to/thumb.png" />
<img class="fullSize" src="path/to/Full.png" />
</div>
.thumbnail:hover + .fullsize {
display: block;
}
Descendants
<ul>
<li><img class="thumbnail" src="path/to/thumb.png" />
<ul>
<li class="fullsize"><img src="path/to/full.png" /></li>
<li class="desc">Description text for above image</li>
</ul>
</li>
</ul>
.thumbnail .fullsize,
.thumbnail .desc {
display: block;
}
For the reverse (to hover over the image to show the menu) isn't possible with CSS, since the cascade is one-way. It's relatively easy to implement with JavaScript though, but I can only offer jQuery (to my shame):
$(document).ready(
function(){
$('.fullsize.').hover(
function() {
$(this).closest('.thumbnail').show();
}
);
}
);
I am curious as to why you want to take this approach, it seems that you want to hover over either item (in this case 'thumbnail' and 'fullsize') to show the other? This implies that one, or both, of these items will at the same time be invisible/hidden. This being the case how does the user know they exist for interaction to take place?
Demo at JS Bin (based on siblings).
Here's an alternative, for an 'anywhere on the page' relationship between the two:
html:
$(document).ready(
function(){
$('.fullsize, .thumbnail').mouseover(
function() {
var currId = $('.fullsize').index();
if ($(this).hasClass('thumbnail')) {
var toShow = '.fullsize';
}
else {
var toShow = '.thumbnail';
}
$(toShow).eq(currId).addClass('show');
}
);
$('.fullsize, .thumbnail').mouseout(
function() {
var currId = $('.fullsize').index();
if ($(this).hasClass('thumbnail')) {
var toShow = '.fullsize';
}
else {
var toShow = '.thumbnail';
}
$(toShow).eq(currId).removeClass('show');
}
);
}
);
It's a little different to @BenWells', in that it doesn't require an explicit relationship, but it does require that the thumbnails
be in the same order as their counterpart fullsize
elements (or vice/versa) since it's based on their index positions.