Instead of "Black and Green" text, We are displaying "Black & Green" images with help of below code.
What we want is this concept should work for all colors, for that one solution is i need to write manual code for hundreds of colors as like below to make it work for all colors. but i think this is wrong way , may be it may impact on performance, is there any better way to handle this ?
Script :
var jQuery = $.noConflict();
jQuery(document).ready(function(){
var inner = Array();
inner = jQuery(" .product-options ul.options-list .label>label");
for (i=0;i<inner.length;i++){
var classN = inner[i].innerText;
if (classN=="Black" || classN=="Green"){
inner.eq(i).addClass(classN);
}
}
});
Css for green :
.product-options ul.options-list .label>label.Green
{
font-weight: normal;
width: 50px;
height: 50px;
border-radius: 50%;
background-image: url("http://sbdev2.kidsdial.com:81/media/catalog/custom/green.png") !important;
background-size: cover !important;
display: block;
color: transparent;
padding: 0 !important;
font-size: 0;
}
Css for black :
.product-options ul.options-list .label>label.Black
{
font-weight: normal;
width: 50px;
height: 50px;
border-radius: 50%;
background-image: url("http://sbdev2.kidsdial.com:81/media/catalog/custom/black.png") !important;
background-size: cover !important;
display: block;
color: transparent;
padding: 0 !important;
font-size: 0;
}