Question

Which one of these attributes is correct?

rel="prettyPhoto[gallery]"

or

rel="prettyPhoto[pp_gal]"

Is this gallery/pp_gal declared somewhere? Can i pass any image gallery to prettyPhoto dynamically (by executing an SQL statement to get some img sources, and pass them somehow to my link that triggers prettyPhoto)?

Was it helpful?

Solution

Just to expand on CBroe's comment, which is perfectly correct but maybe not explicit enough.

The text within the braces can be anything you want. The idea behind it is that you just use that to group different images into a gallery. So;

<a href="..." rel="prettyPhoto[gal1]"><img src="..." /><a/> 
<a href="..." rel="prettyPhoto[gal1]"><img src="..." /><a/> 
<a href="..." rel="prettyPhoto[gal2]"><img src="..." /><a/> 
<a href="..." rel="prettyPhoto[gal2]"><img src="..." /><a/> 
<a href="..." rel="prettyPhoto[gal1]"><img src="..." /><a/> 
<a href="..." rel="prettyPhoto[gal2]"><img src="..." /><a/> 

If you click on image 1 and it launches a lightbox, it will have images 1,2 and 5 in it. ie all the gal1 grouping. Click on image 6 and it will have 3,4 and 6 in it, the gal2 grouping. The plugin uses a regex to do the grouping;

        // Find out if the picture is part of a set
        theRel = $(this).attr(settings.hook);
        galleryRegExp = /\[(?:.*)\]/;
        isSet = (galleryRegExp.exec(theRel)) ? true : false; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top