-2
I’ve created a div that will expand. But when I click expand, all the Ivs open instead of just opening the one I want to expand. Is there any way to open only the div I clicked?
Note: It will be connected to the database and new Ivs will be created over time, so ID is not under consideration.
My code:
Html:
<div class="titulo">Título</div>
<div class="open"><i class="fas fa-chevron-down></i></div>
<div class="open"><i class="fas fa-chevron-up></i></div>
<div class="corpo"></div>
Css:
i.fa-chevron-up{display: none}
.corpo{display: none}
Jquery:
$("i.fa-chevron-down").click(function(){
$(".corpo").slideDown(500);
$("i.fa-chevron-down").hide(0);
$("i.fa-chevron-up").show(0);
});
$(".fa-chevron-up").click(function(){
$(".corpo").slideUp(500);
$("i.fa-chevron-down").show(0);
$("i.fa-chevron-up").hide(0);
});
Emanoel, with this css nothing is shown on the screen except the title. Check if this is it.
– Bruno
Dude, I can’t help you with this code, just do a functional example here: https://jsbin.com/
– Ivan Ferrer