I'm trying to make a code that shows and hides some divs in the click, I tried to use css to help me, but I could not. By the below logic in the click of the "topic" it removes the display class from all items, and adds to the clicked class the display item, so in css for having class entrega.topic.exibir .conteudo1
with display:block;
was to show this content no? Or I'm 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;
}