0
我尝试使用php和jquery mobile构建动态网格。我想知道是否有人可以帮助我使用模数来确定ui-block是否需要是a-d,具体取决于迭代的关键值。使用jquery mobile和模型构建动态网格
<div class="ui-grid-c">
@forelse($photos as $key=>$photo)
@if($key == 1)
<div class="ui-block-a">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@elseif($key == 2)
<div class="ui-block-b">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@elseif($key == 3)
<div class="ui-block-c">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@elseif($key == 4)
<div class="ui-block-d">
<img src="{{ $photo['file'] }}" width="60" />
</div>
@endif
@empty
Nothing Found
@endforelse
</div>
我已经尝试了几种不同的模数变化,但没有任何工作正确。任何帮助,将不胜感激。