I have 10 items in my database table. I want to apply same CSS style to the divs in the arithmetic sequence of 3 items.
For example, items [0, 3,6,9] will have css style slideInDown, items [1,4,7] will have css style slideFloat and items [2,5,8] will have style slideInUp.
@if ($i % 3 == 0)
, I think this will satisfy the series [0, 3,6,9] but how to write logic for other two series.
My code::
@for ($item = 0; $item < count($posts); $item++)
@if ($i % 3 == 0) <!-- for items [0,3,6,9] -->
<div class="content">
<div class="slideInDown text-center">
<p> $posts[$item]['post_content'] </p>
</div>
</div>
@elseif($i == 2) <!-- what will be logic for items [2,5,8] -->
<div class="content">
<div class="slideInUp">
<p> $posts[$item]['post_content'] </p>
</div>
</div>
@else <!-- for items [1,4,7] -->
<div class="content">
<div class="slideFloat">
<p> $posts[$item]['post_content'] </p>
</div>
</div>
@endif
@endfor