We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38713
    • 91 Posts
    Hi chappys and chappets.

    Is there a way to add a "last" class to the last thumbnail on each row of the galAlbumRow template?
    i.e i have 5 on each row due to a fixed width container and each thumb being a fixed size.

    so can i say every fifth li add "last" class in a snippet anywhere or something??

    Any help would be appreciated.

    love you all.
      Twitter @alexmercenary
      • 3548
      • 102 Posts
      You can achieve this on client side through jquery....

      http://api.jquery.com/each/
        Antonio Zdilar
        linearvector.com
        • 38713
        • 91 Posts
        Ok yea. I was hoping i could do this without javascript just for those people who decide to have it disabled.

        Cheers bro!
          Twitter @alexmercenary
          • 3548
          • 102 Posts
          Well, you can do it server side, but I suspect that then you would have to modify Gallery addon itself (I am not aware that it has an option that you need) and it should be trivial task to accomplish. I suggested javascript route because of this.
            Antonio Zdilar
            linearvector.com
            • 38713
            • 91 Posts
            I don't think so either. The javascript option is ideal really... If they haven't got javascript enabled ill just give them a message. A lot of the site utilises js anyway so really this one more function isn't the feature that would ruin it.

            Thanks
              Twitter @alexmercenary
              • 38713
              • 91 Posts
              For anyone who is interested who looks at this thread and wants the same thing i went down the following route in jQuery.

              $(function() {
              $("ul li:nth-child(5n)").addClass(" last");
              });

              every 5th li in the ul it will add last.

              ie. 5th, 10th, 15th etc.

              Over
                Twitter @alexmercenary
                • 30303
                • 25 Posts
                You can make a custom snippet. For example:

                //Use like this in your tpl: [[!switch_last?  &x = `[[+idx]]` &num = `5` &print =`last` ]]
                
                <?php
                $idx = $x + 1 ;
                if (($idx % $num) == 0 ) {
                echo $print;
                }
                
                
                
                  If we can really understand the problem, the answer will come out of it, because the answer is not separate from the problem.
                  J Krishnamurti