I’ve tried using a the math to use check if the loop count is divisible by two but it always returns false
<Math> <Get loop=count /> % 2 == 0 </Math>
is there another way to do this? I want to change the design of an item every 2nd loop
I’ve tried using a the math to use check if the loop count is divisible by two but it always returns false
<Math> <Get loop=count /> % 2 == 0 </Math>
is there another way to do this? I want to change the design of an item every 2nd loop
Hi Mark!
I would consider making a customization like this in CSS if that’s feasible for your use-case, using the :nth-child(even)
selector.
It doesn’t look like the modulo operator is supported by our math tag. @eliot is this something we could/should add support for?
In the newest plugin version, the Math
tag now supports the modulo operator %
.
It can be used like this:
<Math><Get loop=count /> % 2</Math>
Currently, the Math
tag does not support comparison operators like ==
and !=
, or boolean values (true/false). As a work around, you can set the result into a variable, and use the If
tag instead.
<Set remainder><Math><Get loop=count /> % 2</Math></Set>
<If check="{Get remainder}" value="0">
Even
<Else />
Odd
</If>