prettyPhoto gallery without rel attribute

simPod picture simPod · Mar 6, 2013 · Viewed 10k times · Source

I'm using prettyPhoto (http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/)

According to documentation it's being triggered by:

$("a[rel^='prettyPhoto']").prettyPhoto();

However, I'm using just this (rel attribute is not valid according to W3C and it's not needed):

$(".photo a").prettyPhoto();

But I need to make my photos as a gallery, according to documentation it's made by using this:

<a href="images/1.jpg" rel="prettyPhoto[pp_gal]"><img src="images/1b.jpg" /></a>

(rel tag has gallery name between [ ])


Is there any way how to define gallery without rel tag?

Answer

simPod picture simPod · Apr 3, 2013

Found the solution via the comment above: validation error on prettyPhoto's rel attribute

Specify your links like this: <a href="img.jpg" data-gal="prettyPhoto[gal]"></a> and use $("a[data-gal^='prettyPhoto']").prettyPhoto({hook: 'data-gal'}); to initialize prettyPhoto.