Trying to target the closet selector to the click

Trying to target the closet selector to the click

Hello! I have this section that is dynamically added to a page in Wordpress with Advanced Custom Fields if needed as many times as the layout asks. I originally only had one of these sections on the page and it worked great but now I have the issue that when there are two or more of these sections added all the slideDown/slideUp act on click of any of the buttons. I have been looking for a way to utilize .next() or .closest() but not finding the solution so that the closest div class of .layer--content_slide_out will slide down/up and not all of them. Here is my HTML code:

  1. <section class="layer--content_slide_out">

  2.   <div class="container row">

  3.     <div class="row">
  4.         <div class="layer--content_slide_out_content">
  5.           <?php echo $layer['content_1']; ?>
  6.           <?php if($layer['has_button_content_1'] && !empty($layer['has_button_content_1'])): ?>
  7.           <a class="layer--content_slide_down_button button"><?php echo $layer['button_text_content_1']; ?></a>
  8.           <?php endif ?>
  9.         </div>
  10.         <div class="push_six layer--content_slide_out_content">
  11.           <?php echo $layer['content_2']; ?>
  12.           <?php if($layer['has_button_content_2'] && !empty($layer['has_button_content_2'])): ?>
  13.           <a class="layer--content_slide_down_button button"><?php echo $layer['button_text_content_2']; ?></a>
  14.           <?php endif ?>
  15.         </div>
  16.     </div>

  17.   </div>

  18. </section>
  19. <section class="layer--content_slide_down">

  20.   <div class="container row">

  21.     <div class="layer--content_slide_down_content">

  22.       <div class="left-content">
  23.         <?php echo $layer['slide_content_1']; ?>
  24.       </div>

  25.       <div class="right-content">
  26.         <?php echo $layer['slide_content_2']; ?>
  27.       </div>

  28.     </div>

  29.     <div class="close-x">
  30.       <span>X</span>
  31.     </div>

  32.   </div>

  33. </section>

Here is my jQuery code:

  1. /* Content Slide Out */
  2.   $('.layer--content_slide_down_button').click(FadeSlideIn);
  3.   $('.close-x').click(FadeSlideOut);

  4.   function FadeSlideIn(ID) {
  5.       $(element.target).closest('.layer--content_slide_out').nextAll(".layer--content_slide_down").stop(true, true).slideDown('slow');
  6.   }

  7.   function FadeSlideOut(ID) {
  8.       $(element.target).closest('.layer--content_slide_out').nextAll(".layer--content_slide_down").stop(true, true).slideUp('slow');
  9.   }