How to count foreach loop by range

前端 未结 1 393
时光取名叫无心
时光取名叫无心 2021-01-23 19:19

I\'m trying to make the carousel slide image slide by 4 images per slide. I want each slide to display four images, and then the next slide will display another four images. I h

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-23 20:08

    I believe that will do the trick:

     $photo){
    ?>
        
    
    

    The point is to use $k, whenever it is divisible by 4 (4, 8, 12, 16, ...), with the function $k % $numImagesPerSlide == 0 then you print the code you need. I guess you will need an extra code, like

    if ($k % $numImagesPerSlide == 0) {
        //print the header of the carrousel
    }
    

    0 讨论(0)
提交回复
热议问题