PrettyPhoto显示单个图像,但图库不起作用。这是在浏览器上呈现图像的方式:
<a href="/images/reviews/full/2/ii_15986_1429535345455.jpg" data-rel="prettyPhoto[reviewsgallery]" class="ui-link" sl-processed="1">
<img itemprop="photo" src="/images/reviews/full/2/ii_15986_1429535345455.jpg" width="100%" height="auto">
</a>
这是jQuery:
jQuery(document).ready(function () {
jQuery("a[data-rel^='prettyPhoto']").prettyPhoto({
});
});
我不得不使用“data-rel”,因为“rel”刷新了jQuery-mobile.1.1.1中的页面。
答案 0 :(得分:1)
是的,你是对的,只需使用:
<a href="/images/reviews/full/2/ii_15986_1429535345455.jpg" data-pretty-photo="prettyPhoto[reviewsgallery]" class="ui-link" sl-processed="1">
<img itemprop="photo" src="/images/reviews/full/2/ii_15986_1429535345455.jpg" width="100%" height="auto">
</a>
并在javascript中:
jQuery("a[data-rel^='prettyPhoto']").prettyPhoto({
hook : 'data-pretty-photo'
});
它应该可以正常工作。我在文档中找不到它,但它在源代码中可见:
hook: 'rel', /* the attribute tag to use for prettyPhoto hooks. default: 'rel'. For HTML5, use "data-rel" or similar. */