I understand now, and I appreciate your help.

A new problem has arisen from this.  It seems that this loops through
elements grouped in 3, rather than apply the class for the first
column first, then the second one.

Here is what I mean.  Say I have 9 p tags containing links.  This is
how the script writes the classes:

<p class="first">Content</p>
<p class="second">Content</p>
<p class="third">Content</p>
<p class="first">Content</p>
<p class="second">Content</p>
<p class="third">Content</p>
<p class="first">Content</p>
<p class="second">Content</p>
<p class="third">Content</p>

So, when I group those by class name, and add a column div around
them, they are completely out of their original order.  What I really
need to do is:

<p class="first">Content</p>
<p class="first">Content</p>
<p class="first">Content</p>
<p class="second">Content</p>
<p class="second">Content</p>
<p class="second">Content</p>
<p class="third">Content</p>
<p class="third">Content</p>
<p class="third">Content</p>

This way, it will group them properly when I use the wrapAll function.

Is there a way to do it this way?

Thanks again for your help!

On Mar 3, 11:02 am, brian <bally.z...@gmail.com> wrote:
> On Tue, Mar 3, 2009 at 1:48 PM, Nic Hubbard <nnhubb...@gmail.com> wrote:
>
> > Should I keep the division by 10 on the Math function?
>
> No, as i said, that's the problem. There's not only no need for it,
> but it's giving you results you don't want. Quick: what's zero divided
> by ten? And what's the remainder of that result divided by 3?
>
> This should help to illustrate what's going on:
>
> $('#artistsColumns p').each(function(i){
>         var d = Math.floor(i/10);
>         var n = d % 3;
>         $(this).html('<strong>d:' + d + ' n:' + n + '</strong><br />' +
> $(this).html());
>         $(this).addClass(classNames[n]);
>
> });

Reply via email to