using javascript modulus to update rows of tiles position
<p>I want to create a grid of tiles using <code>position:absolute</code> that consists of 5 tiles per row, as I'm not sure how many tiles will ever be present I want to create some javascript that loops through the tiles and dynamically adds the top and left position so:</p>

<p>1st row: top:0; left:0 then 51px then 102px...
2nd row: top:51px; left: 0 then 51px then 102px..
3rd row ...</p>

<p>Im aware I need to use modulus in my loop but I'm really only familiar with picking a 1 item like i%4 == 0 instead of actually influencing full rows?</p>

<p>Can anyone explain how I can achieve this? </p>

<p>JS</p>

<pre><code>var list = $('ul').children();

for ( var i = 0; i &lt; list.length; i++ ) {

    console.log(i);
    console.log( list[i] );    

    // first 5 top: 0 left: 0,51,102,153,204
    // second 5 top:51 left: 0,51,102,153,204
    // third 5 top: 102 left: 0,51,102,153,204
    $( list[i] ).css({
        left: i*51        
    });   


}
</code></pre>

<p>Fiddle here: <a href="http://jsfiddle.net/Z7TwF/4/" rel="nofollow">http://jsfiddle.net/Z7TwF/4/</a></p>
