4
I need to create an effect similar to that site here when you click on the product opens a div with the Infos of it then click on it again that div closes, but if I click on another product and the div has already opened it just changes the content with the instructions 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 only the Infos it closes and opens the div again.
Follow my code js:
$('.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>
I can do this effectWith the slideToggle itself or I have to use another resource?
UPDATE:
Add so an example of how ta the HTML code did not put it pq ta quite large and has snippets in PHP (wordpress theme).
UPDATE 2
the ID "dynamic value" is the same value as the rel of the element .
can post html, to stay more
– Marcelo Batista
@Marcelobatista o html esta meio grande, eh a wordpress template, but I will edit and put an example like this. Vlw
– user27585
No more html is hard to help. But there’s only one
product-info
for everyone ? Or each product has its ownproduct-info
? Therel
of<a>
has what ?– Isac
@Isac but what is missing is only content, yes only has a product-into what changes is the container, cda product has its container. rel is the same value as id = "dynamic value".
– user27585