是否可以自动将相同的图像插入每三张幻灯片


Is it possible to automatically insert the same image to every third slide

我正在使用自定义字段,并希望每三张幻灯片添加一个图像。你是怎么做到的..可以使用jQuery完成吗以及如何完成?太新了

    <div class="flexslider">
        <ul class="slides slide-ul">
            <?php while(the_repeater_field('text_scroll')): ?>
                <li class="slide">
                    <span class="scroll-text1 slider"><?php the_sub_field('scroll_top_text');?></span>
                     <span class="scroll-text2 slider"><?php the_sub_field('scroll_bottom_text');?></span>
                </li>
                <?php endwhile; ?>
        </ul>
    </div>

使用第 n 个子选择器

演示

$('.slide:nth-child(3n)').append('<img src="IMage.jpg" />');

使用普通 PHP

<div class="flexslider">
    <ul class="slides slide-ul">
        <?php $i=0 ; while(the_repeater_field( 'text_scroll')): 
        if($i % 3===0 ){echo '<li>each 3rd row this row will display</li>';} ?>
        <li class="slide"> 
            <span class="scroll-text1 slider">
                <?php the_sub_field('scroll_top_text');?>
            </span>
             <span class="scroll-text2 slider">
                 <?php the_sub_field('scroll_bottom_text');?>
            </span>
        </li>
        <?php $i++; endwhile; ?>
    </ul>
</div>