Displaying items in a different column depending on position
Hi Guys,
I was wondering if there was any quick way to do the following:
@foreach(first item and every third item after position 1)
<div class="col-md-4">
<div class="item-container">
<h2>@item.Header</h2>
</div>
</div>}
@foreach(second position item and third item after position 2){
<div class="col-md-4">
<div class="item-container">
<h2>@item.Header</h2>
</div>
</div>}
@foreach(third position item and third item after position 3){
<div class="col-md-4">
<div class="item-container">
<h2>@item.Header</h2>
</div>
</div>}
With the output:
<div class="col-md-4">
<div class="item-container">
<h2>#item1</h2>
<h2>#item4</h2>
<h2>#item7</h2>
etc.
</div>
<div class="col-md-4">
<div class="item-container">
<h2>#item2</h2>
<h2>#item5</h2>
<h2>#item8</h2>
etc.
</div>
<div class="col-md-4">
<div class="item-container">
<h2>#item3</h2>
<h2>#item6</h2>
<h2>#item9</h2>
etc.
</div>
This isn't really something I can do with i % 4 or with position() mod 3 right?
Displaying items in a different column depending on position
Hi Guys,
I was wondering if there was any quick way to do the following:
With the output:
This isn't really something I can do with
i % 4
or withposition() mod 3
right?Can you please explain your problem in more detail would be good by diagram
Hello Manish,
See the attached image. I hope that helps.
Create three list something like this
}
Thanks Manish,
I'll go and try it and get back to you!
is working on a reply...