2
I have the following HTML:
<div class="unidadesTotal">
<div class="unidades">tituloSYS</div>
<div style="display:none" class="unidadesConteudo margin-top-25">
<div class="margin-left-10"> <span>descricaoSYS</span>
</div>
<div class="atendimento unidadesAtendimento margin-top-15 f-left">horário de atendimento</div> <a href="codigoSYS" target="_blank"><div class="unidadesAtendimento unidadesLocalizacao margin-top-15 margin-left-10 f-left">ver localização</div></a>
</div>
</div>
The unidadesTotal is a button, when I click on it the unidadesConteudo let it be display:None and becomes display:block, So far perfect, here’s my Jquery:
$('.unidadesTotal').click(function () {
$(this).parent().find('.unidades').addClass('unidadesHover');
$(this).parent().find('.unidadesConteudo').slideDown();
});
How would I make an IF for the Give One button slideup?
The
!$is the "else", right? I haven’t worked with him yet, with Jquery.– Felipe Viero Goulart
the
!is an operator who denies the subsequent condition, for example.:if (!true)meansfalseandif(!false)meanstrue– Paulo Roberto Rosa
You could also reverse things, remove the
!and exchange place codes with each other, leaving the.slideDown()in theelseand the.slideUp()in theif, also works :D– Paulo Roberto Rosa
I edited the answer so that it will be better understood for you.
– Paulo Roberto Rosa
The explanation was perfect!
– Felipe Viero Goulart