Consider the following scenario:
- The gallery-menu consists of 2 title-images and 7 sub-images.
- 3 sub-images are connected to title-image 1, while 4 sub-images are linked to title-image 2.
- The sub-images are not in order corresponding to their titles.
- All images are enclosed in an "a" tag; each title-image and its sub-images link to the same page.
I am trying to establish multiple hover effects in an asymmetrical manner: - When hovering over a title-image, that image along with all its related sub-images should change to their hover state. - If a sub-image is hovered over, it and its associated title image should switch to their hover states (without affecting the rest of the set).
I hope this explanation makes sense :-)
Despite my efforts to achieve this using CSS, I believe it may not be possible. JQuery appears to offer a solution, but my proficiency in it is limited.
Could someone guide me in the right direction?
.galleryitem:hover img.off { display: none; }
.galleryitem img.on { display: none; }
.galleryitem:hover img.on { display: inline-block; }
.float {
float: left;
}
<!-- TITLE A -->
<div id="A" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/654abe" alt=""/>
</div>
<!-- TITLE B -->
<div id="B" class="galleryitem">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/26a2cc" alt=""/>
</div>
<!-- JUMBLED SUB-IMAGES -->
<div id="wrapper">
<div id="A1" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/654abe" alt=""/>
</div>
<div id="B1" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/26a2cc" alt=""/>
</div>
<div id="A2" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/654abe" alt=""/>
</div>
<div id="B2" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/26a2cc" alt=""/>
</div>
<div id="A3" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/654abe" alt=""/>
</div>
<div id="A4" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/654abe" alt=""/>
</div>
<div id="B3" class="galleryitem float">
<img class="off" src="http://placehold.it/100x50" alt=""/>
<img class="on" src="http://placehold.it/100x50/26a2cc" alt=""/>
</div>
</div>