On Oct 30, 9:46 am, solidhex <[EMAIL PROTECTED]> wrote:
> I am trying to figure out a way to zebra stripe list items in an
> unordered list. The only tricky part is that I don't want to zebra
> stripe the nested lists, but I want to maintain the same every other
> stripping pattern on the nested list's parent. Here is an example of
> the structure that I want to get at (I've added in the class here
> manually to make it more clear what I am trying to do):
[...]
>
> My attempt to pull this off is something like:
>
> document.observe("dom:loaded", function() {
> $$("ul.foo li").each(function(el, i) {
> if (!el.up(1).match('li') && i % 2 == 0) {
Change the selector:
$$("ul.foo>li").each(function(el, i) {
A shorter test, returns true for even numbers, remove ! to get true
for odd numbers (noting that the first element is index 0 so is even,
although its position is 1, which is odd - but not *that* odd):
if ( !(i%2) ) {
--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---