I need to create an effect similar to that of this site here when clicking the product opens a div with the infos of it there I click on it again this div closes, but if I click on another product and the div has already opened it just changes the contents with the infos of the product that I clicked.
I'm trying to use slideToggle (); to do this, but when I click on another product instead of changing it just the infos it closes and opens the div again.
Follow my js code:
$('.menu li a').on('click', function () {
var target = $(this).attr('rel');
$("#" + target).slideToggle().siblings(".product-info").hide();
});
/* Exemplo de como ta o codigo HTML */
<div>
<div id="Valor Dinamico" class="product-info">
<div class="container"></div>
</div>
</div>
Can I do this with the same slideToggle or do I have to use another feature?
UPDATE:
Add only an example of how the HTML code is not put it pq ta very large and has sections in PHP (theme wordpress).
UPDATE 2
The ID "dynamic value" is the same value as the rel of the element.