Thanks MorningZ :), yes that is the one I'm trying to mimic. "odd" is only
declared in:

$("div.postSummary-teaser:odd").addClass("odd");

Where else should it be? I was hoping this code would just add it to
alternate divs with a class of "postSummary-teaser"

The html is actually:

<!-- Entry -->

    <div class="postSummary" id="post-125">
        <!-- Post Top Summary -->
        <div class="postSummary-top">
            <h3><a href="link">title</a></h3>
            <p>Posted by: <a href="link" title="View all posts by "
class="author-link">author name</a> in <i>label here</i>&nbsp; on
                <span class="post-date">date here</span>

            </p>
                    </div>

        <!-- Post Teaser Text -->
        <div class="postSummary-teaser">
            html of teaser text goes here

            <!-- Post Footer -->
            <p class="postSummary-footer">
                            <a href="link" class="postSummary-comments">link
to comments</a>

                            <a href="link to full article"
class="postSummary-readmore">Read More...</a>


            </p>
        </div>

        <!-- Post Divider -->
        <hr class="postEntry-divider" />

    </div>
    <div class="clear"></div>

then it repeats itself if there are more posts. I now realise I should be
using postSummery not postSummary-teaser, I made the change. I just tried it
in a static page with nothing else in it just to make sure there are no
conflicts.

It still does not work though:
http://www.digiflipconcepts.com/digiflip-v3/templates/digiflip/test.html

:( ?


2009/2/17 MorningZ <morni...@gmail.com>

>
> so this is the jQuery you are trying to mimic?
>
> $("tr:nth-child(odd)").addClass("odd");
>
> ??
>
> that uses current selector syntax (http://docs.jquery.com/Selectors/
> nthChild#index <http://docs.jquery.com/Selectors/%0AnthChild#index>), and
> would indeed work on
>
> <table>
>    <tr>
>        <td>Row 1</td>
>    </tr>
>    <tr>
>        <td>Row 2</td>
>    </tr>
>    <tr>
>        <td>Row 3</td>
>    </tr>
>    <tr>
>        <td>Row 4</td>
>    </tr>
> </table>
>
> If you had
>
> <div class="postSummary-teaser">Teaser 1</div>
> <div class="postSummary-teaser">Teaser 2</div>
> <div class="postSummary-teaser">Teaser 3</div>
> <div class="postSummary-teaser">Teaser 4</div>
> <div class="postSummary-teaser">Teaser 5</div>
>
> then, there's no reason why
>
> $("div.postSummary-teaser:odd").addClass("odd");
>
> wouldn't give zebra stripes (as long as class name "odd" is declared
> somewhere)
>
>
>
> On Feb 16, 9:09 pm, mark law <m...@digiflip.tv> wrote:
> > I copied it from here:
> http://blog.jquery.com/2006/10/18/zebra-table-showdown/and tried
> > unsuccessfully to modify it for div classes ...
> >
> > 2009/2/17 MorningZ <morni...@gmail.com>
> >
> >
> >
> > > I'm just curious... where are you getting your syntax from?
> >
> > > "div:.postSummary"  ????
> >
> > > ".postSummary-teaser(odd)" ??
> >
> > > there's now where in the documentation (http://docs.jquery.com) where
> > > that syntax is shown
> >
> > > On Feb 16, 6:31 pm, morktron <m...@digiflip.tv> wrote:
> > > > Hi I'm just wondering whether it is possible to zebra stripe
> alternate
> > > divs
> > > > with the same class name?
> >
> > > > The class name is .postSummary-teaser, I tried this:
> >
> > > > <script type="text/javascript">
> > > >       window.onload = function(){
> > > >     $("div:.postSummary-teaser(odd)").addClass("odd");};
> >
> > > >     </script>
> >
> > > > but no joy. I'm no Javascript programmer but it was easy to stripe
> > > alternate
> > > > rows with a tutorial on the jQuerey site. There seems to be nothing
> about
> > > > using divs?
> >
> > > > The page in question is in development here:
> > >http://www.digiflipconcepts.com/digiflip-v3/Rant-and-Rave
> >
> > > > Can anyone help? thanks
> > > > --
> > > > View this message in context:
> > >http://www.nabble.com/how-to-zebra-stripe-divs--tp22048135s27240p2204.
> ..
> > > > Sent from the jQuery General Discussion mailing list archive at
> > > Nabble.com.
>

Reply via email to