Group images together for use with Fancybox (jQuery)

Fancybox is a great jQuery plugin with lots of great options.  Here is a small snippet of jQuery to add the grouping vai jQuery, which you might want to do with say a WordPress gallery so the client doesn’t need to add any additional markup.

You can then wrap the entire gallery in a<div> tag or perhaps use a selector something like body.gallery a.

Update 5th February 2013 – Further to the comments below, please find a code sample below to group the lightbox per post:

Grow your digital and realise your potential