没有rel属性的prettyPhoto库

时间:2013-03-05 23:27:27

标签: prettyphoto

我正在使用prettyPhoto(http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/

根据文件,它由以下方式触发:

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

但是,我正在使用这个(根据W3C,rel属性无效,并且不需要):

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

但是我需要将我的照片作为一个画廊,根据使用它制作的文档:

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

(rel代码在[ ]

之间有图库名称

有没有办法在没有rel标签的情况下定义图库?

1 个答案:

答案 0 :(得分:4)

通过上述评论找到解决方案:validation error on prettyPhoto's rel attribute

指定您的链接:<a href="img.jpg" data-gal="prettyPhoto[gal]"></a>并使用$("a[data-gal^='prettyPhoto']").prettyPhoto({hook: 'data-gal'});初始化prettyPhoto。