And now how can I do the reverse functions?, by clicking I want that when the div cont-fieldBusq-relat is display: block; I want you to remove the styles that were assigned when we clicked on it, the function that I would like it to be is to give opacity first and then give it a display: none; to cont-campoBusq-relat
$(document).ready(function () {
$('.buscarHMn').click(function () {
if ($('#cont-campoBusq-relat') != "block") {
$('#cont-campoBusq-relat').css({display:"block",});
setTimeout(function(){
$('#cont-campoBusq').animate({"opacity":"100"});
}, 1000);
} else {
alert("ELSE");
}
});
});
.buscarHMn{
width:100px;
height: 100px;
background:gray;
color: white;
}
#cont-campoBusq-relat{
display: none;
width:100px;
height: 100px;
background:brown;
color: white;
}
#cont-campoBusq{
display: ;
width:70px;
height: 80px;
background:orange;
color: white;
opacity:0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="buscarHMn">Click</div>
<div id="cont-campoBusq-relat">
<div id="cont-campoBusq"</div>
</div>