We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Flip flop content blocks with grid....

How Do I?

andrew001's avatar
andrew001
136 posts
9 years ago
andrew001's avatar andrew001

I am looking for something more that “switch” - i think.

I am using zurbs foundation for the UI and EE grid for a part of a product. Im using EE 2.11

I need to literally flip flop blocks of content. As in, alternate content left to right down the page.

Basically, its like this:

<div class="row">
  <div class="large-6 columns">image</div>
  <div class="large-6 columns">title, subtitle, description</div>
</div>
<div class="row">
  <div class="large-6 columns">title, subtitle, description</div>
  <div class="large-6 columns">image</div>
</div>

Note that the rows are same size, but the content within flips.

I really would like to use the grid for this, otherwise my channel fields for a single product entry will be really large.

Any idea how to pull this off using grid?

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
9 years ago
Kevin Cupp's avatar Kevin Cupp

Check out the modulus operator, should be able to do what you need:

https://ellislab.com/blog/entry/the-modulus-operator

Should be able to do something like {if gallery:count % 2 > 0} Layout A {if:else} Layout B {/if} to do something every other row.

       
FountainInternet's avatar
FountainInternet
53 posts
9 years ago
FountainInternet's avatar FountainInternet

Alternatively, if you’re supporting only modern browsers, you can use CSS flexbox to reverse the order of columns in a row:

.flow_rtl {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: row-reverse;
    flex-direction: row-reverse;
    -webkit-flex-wrap: wrap-reverse;
    flex-wrap: wrap-reverse;
}

The above class would be applied to the row div.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.