0
I’m trying to make a code that shows and hides some Ivs in the click, I tried to use css to help me, but I couldn’t. By the logic at the bottom of the "topic" click it removes the display class from all items, and adds to the item clicked the display class, then in the css by having the class entrega.topic.exibir .conteudo1
with display:block;
was to show this content no? Or am I doing something wrong.
html
<section class="central">
<nav>
<ul>
<li><a class="icon-entrega"><span class="icon ic entrega topic"><p>Entregas</p></span></a></li>
<li><a class="icon-gift"><span class="icon ic icon-gift topic"><p>Compras</p></span></a></li>
<li><a class="icon-prod-flor"><span class="icon ic prod-flor topic"><p>Produtos</p></span></a></li>
<li> <a class="icon-lock"><span class="icon ic lock topic"><p>Segurança</p></span></a></li>
</ul>
</nav>
</section>
<section class="blc-ca">
<div class="conteudo1"></div>
<div class="conteudo2"></div>
<div class="conteudo3"></div>
<div class="conteudo4"></div>
</section>
jQuery
$j(document).on('click','.topic',function(){
$j('.topic').removeClass('exibir');
$j(this).addClass('exibir');
});
Css
section.blc-ca div {
display:none;
}
.entrega.topic.exibir .conteudo1 {
display: block;
}
.icon-gift.topic.exibir .conteudo2 {
display: block;
}
.prod-flor.topic.exibir .conteudo3 {
display: block;
}
.lock.topic.exibir .conteudo4 {
display: block;
}
Yes, thank you. I hadn’t thought of that solution
– Gustavo Souza