我尝试使用jQuery简单地将.alt类添加到主article中的备用section块中,如下所示:
html5:
<section id="content" role="main">
<h1>Main Title</h1>
<article id="post-1" class="post-1 post type-post">
.. article content ..
</article>
<article id="post-2" class="post-2 post type-post">
.. article content ..
</article>
<article id="post-3" class="post-3 post type-post">
.. article content ..
</article>
</section>jQuery:
$('#content article:nth-child(odd)').addClass('alt');我是不是漏掉了什么...?这肯定能行得通吧?!
发布于 2013-08-21 22:39:49
上面的代码可以工作,我的jQuery文件中的其他内容抛出了问题。请参阅上面的评论。
https://stackoverflow.com/questions/6359516
复制相似问题