JQuery nth-child not working properly

Posted by Keith Donegan on Stack Overflow See other posts from Stack Overflow or by Keith Donegan
Published on 2010-04-23T13:55:21Z Indexed on 2010/04/23 14:23 UTC
Read the original article Hit count: 221

Filed under:
|

Hi Guys,

I am using JQuery's nth-child selector to alter the margin on every 3rd div with a class of photo_post_thumbnail, but it alters it every 2nd div?

Can anyone spot what I am doing wrong?

Site

http://www.clients.eirestudio.net/hatstand/wordpress/photos/

HTML markup

<div class="postbox photo_post_thumbnail">
      blah blah
</div>

<div class="postbox photo_post_thumbnail">
      blah blah
</div>

<div class="postbox photo_post_thumbnail">
      blah blah
</div>

JQuery Code

$('.photo_post_thumbnail:nth-child(3n)').css('margin-right', '0px');

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about nth-child