This question has already been answered:
$('.button').click(function() { $('.down_i').slideToggle(); }) Using the button with the button class, I use the slideToggle function on the block with the down_i class that I down_i .
When .down_i blocks become two and more, when you click on a .button any of the blocks, all existing .down_i open at once.
How to make it so that only the .down_i the block on which I click is opened?
HTML:
<div class="items_1-c"> <div class="item"> <div class="up_i"> <div class="button">驻专讟讬诐 谞讜住驻讬诐</div> </div> <div class="down_i"> <h4 class="h4">:驻专讟讬诐 谞讜住驻讬诐</h4> </div> </div> <div class="item"> <div class="up_i"> <div class="button">驻专讟讬诐 谞讜住驻讬诐</div> </div> <div class="down_i"> <h4 class="h4">:驻专讟讬诐 谞讜住驻讬诐</h4> </div> </div> <div class="item"> <div class="up_i"> <div class="button">驻专讟讬诐 谞讜住驻讬诐</div> </div> <div class="down_i"> <h4 class="h4">:驻专讟讬诐 谞讜住驻讬诐</h4> </div> </div> </div>
.btninstead of.button- Grundy$(this).closest('.item').find(".down_i").slideToggle(). - Regent$(this).parent().next().slideToggle()- Grundy