在移动设备上切换显示/隐藏配置 - ACF中继器

I am using the ACF Repeater to create rows of images/content and to show/hide when clicked. Everything looks good on desktop screens, with a row of 3 images, when an image is clicked, the hidden div shows up below and the background color toggles on so you know which image's content you are looking at.

My problem, is I am trying to get the same functionality on mobile, but when an image is clicked, the content shows up under the 3rd div. I want to be below the image that was clicked. Since I am using the ACF repeater, my php script creates the parent div (3 across) first and then the hidden divs below.

I don't mind creating a separate html markup for mobile, I just can't figure out how to make it work with the ACF repeater.

<div class="staff">
<?php if (have_rows('staff_rows')):
while (have_rows('staff_rows')): the_row(); ?>
<div class="staff-wrap">
<div class="staff_images">        
<?php if (have_rows('staff_images')):
while (have_rows('staff_images')): the_row(); ?>
<a href="#/" class="<?php the_sub_field('staff_class'); ?> show staff-box"> 
<img src="<?php the_sub_field('staff_image'); ?>"><div class="image-box"><h3> 
<?php the_sub_field('staff_name'); ?></h3>
     <h3><?php the_sub_field('staff_position'); ?></h3></div>
  </a>

 <?php endwhile;
 endif; ?>
<?php if (have_rows('staff_bios')):
 while (have_rows('staff_bios')): the_row(); ?>
 <div class="bios">
<div class="wrap">
<div class="<?php the_sub_field('bio_class'); ?> row"><?php 
the_sub_field('bio_text'); ?></div>
</div>
</div>
<?php endwhile;
endif; ?>
</div>

http://toolboxdevmachine.com/TechNiche/about-us

Thanks for your help

I'm guessing you've already figured this out by now, in 2019. It looks like you are missing a few closing <div> tags, as well as ending your while loop and the primary conditional. I broke out the code, indented it and wrote it with the correct closing tags:

<div class="staff">
  <?php if (have_rows('staff_rows')):
    while (have_rows('staff_rows')): the_row(); ?>
      <div class="staff-wrap">
        <div class="staff_images">        
          <?php if (have_rows('staff_images')):
            while (have_rows('staff_images')): the_row(); ?>
              <a href="#/" class="<?php the_sub_field('staff_class'); ?> show staff-box"> 
                <img src="<?php the_sub_field('staff_image'); ?>">
                <div class="image-box">
                  <h3><?php the_sub_field('staff_name'); ?></h3>
                  <h3><?php the_sub_field('staff_position'); ?></h3>
                </div>
              </a>
            <?php endwhile;
          endif; ?>
          <?php if (have_rows('staff_bios')):
            while (have_rows('staff_bios')): the_row(); ?>
            <div class="bios">
              <div class="wrap">
                <div class="<?php the_sub_field('bio_class'); ?> row">
                  <?php the_sub_field('bio_text'); ?>
                </div>
              </div>
            </div>
          <?php endwhile;
        endif; ?>
      </div>
    </div>
  <?php endwhile; ?>
<?php endif; ?>