I'm currently facing an issue with a block that contains multiple divs representing products. My goal is to have the selected product highlighted while the rest appear less prominent when clicked. I've managed to achieve this functionality, however, every time a new product is clicked, all previously selected products also become less sharp.
Below is my current jQuery code:
$(document).ready(function () {
var $all_listItems = $('.choose-format-block .format-area a');
$all_listItems.on('click', function () {
var index = $all_listItems.index(this);
$(this).siblings().stop().fadeTo(300, 0.6);
$(this).parent().siblings().stop().fadeTo(300, 0.3);
});
});
Here's a link to my working example on jsfiddle: http://jsfiddle.net/justamir/P7b5T/2/
If anyone could provide assistance with this (I am new to jQuery), it would be greatly appreciated.