About this topic

  • Posted by criography 1 year ago. There are 4 posts. The latest reply is from byron.
  • This topic is not resolved

No tags yet.

  1. Hi,

    Let's say I have a 3x3 listing of images and want to add a class to the last image of each row, yet couldn't see any option to do it. Is this built in? If not I was wondering how difficult would it be to add the functionality.

    Otherwise fantastic plugin! Great job!

  2. Thanks, crio, glad you like it!

    Unfortunately, PhotoSmash doesn't do this, but you can totally do it with jQuery.

    The question would be which element you'd want to add the class to (the li, div, img, etc)? Then, it's just a matter of running it through .each().

    Here's some basic code that should work for adding it to the img (not tested):

    jQuery(document).ready(function() {
      var i = 0;
      jQuery("img.ps_images").each(function() {
          if (i % 3 == 0) {
               jQuery(this).addClass('my-new-class');
          }
      });
    }

    Here's a StackOverflow article on the problem too: http://stackoverflow.com/questions/1260277/addclass-every-nth

    Cheers,
    Byron

  3. Ha! yes well, I was trying to achieve it without any JS(; I guess I'll have to perform some css trickery in this case. Thanks for the quick response!

  4. Welcome,
    BB

RSS feed for this topic