You can use this and adapt it.
You can use the title attribute also.
Code: Select all
<img src="{{ option_value.image }}" title="{{ option_value.name }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" class="img-thumbnail" />
Style
Code: Select all
<style>
.hoverdiv {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.hoverdiv .hovertext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position hover text */
top: 50px;
right: 50%;
position: absolute;
z-index: 1;
}
.hoverdiv:hover .hovertext {
visibility: visible;
}
</style>
Then you can add a span tag to your options images
Code: Select all
<div class="hoverdiv">Hover over me
<span class="hovertext">This is the text that will display{{ option_value.name }}</span>
<img src="my.jpg" alt="my image" title="my image" class="img-responsive">
</div>
You need to make the DIV as well.
The divs and spans then need adding to the options code in the product twig.
There you can the pickup the option VALUE name or whatever you want.
Once its working how you like you then need to POSITION the hover text to suit.
I will make an extension for it if you like :-)