简体   繁体   English

具有有效W3C但没有图库的prettyPhoto

[英]prettyPhoto with valid W3C but no Gallery

I'm using the current code in the header to make prettyPhoto valid by W3C. 我正在标题中使用当前代码来使W3C使prettyPhoto有效。

 jQuery(document).ready(function() {
     jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({
     social_tools:false 
     });
 });

Untouched Code and Recommended by prettyPhoto Documentation 原始代码,由prettyPhoto文档推荐

<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
});
</script>

With the on page code as follows. 使用如下页面代码。

<li><a href="http://cdn.domain.com/1.jpg" data-gal="prettyPhoto[pp_gal]"><img class="lazy" src="http://cdn.domain.com/grey.gif" data-original="http://cdn.domain.com/1.jpg" alt=""></a></li>
<li><a href="http://cdn.domain.com/2.jpg" data-gal="prettyPhoto[pp_gal]"><img class="lazy" src="http://cdn.domain.com/grey.gif" data-original="http://cdn.domain.com/2.jpg" alt=""></a></li>  

PS. PS。 It's using LazyLoad on the thumb, but thats working fine too. 它在拇指上使用LazyLoad,但这也可以正常工作。

The images are WORKING in the lightbox by prettyPhoto but they are not opening in Gallery (no next, prev etc, I think its not detecting the other images using the same tag), I suspect it has to do with the [pp_gal] and the code that I've written to get it working on data-gal instead of rel=. 图像正在通过prettyPhoto在灯箱中工作 ,但是它们没有在图库中打开(没有下一个,上一个等,我认为它没有使用同一标签检测其他图像),我怀疑它与[pp_gal]和我为使其在data-gal而不是rel =上运行而编写的代码。

I suspect this is a easy fix for the jQuery Gurus. 我怀疑这对于jQuery Gurus是一个简单的解决方案。 Thanks 谢谢

Since the value of your data attraibutes is prettyPhoto[pp_gal] and not plain prettyPhoto we can infer that the prettyPhoto plug-in looks there to get the information it needs to do what you want. 由于您的数据属性值是prettyPhoto[pp_gal]而不是普通的prettyPhoto我们可以推断prettyPhoto插件会出现在此处,以获取执行所需操作所需的信息。

You need to go into the source of prettyPhoto and make it look at data-gal instead of rel . 您需要进入prettyPhoto的源代码,并使其看起来在data-gal而不是rel

After investigating it seems that prettyPhoto have improved their code recently and adopting this change was straight forward since they now Hook the 'REL' attribute and changing one value fixes all. 经过调查后,prettyPhoto似乎最近对其代码进行了改进,并且采用这种更改是很直接的,因为他们现在使用了“ REL”属性,并且更改一个值可以解决所有问题。 Whoop Whoop! Who!

Believe is an example of how to make prettyPhoto W3C Valid. 相信是如何使prettyPhoto W3C有效的一个示例。 Online 8 you have this 在线8你有这个

(function($){$.prettyPhoto={version:'3.1.4'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({hook:'data-gal',animation_speed:'fast',ajaxcallback:function(){},slideshow:5000,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,allow_expand:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'pp_default',horizontal_padding:20,hideflash:false,wmode:'opaque',autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,overlay_gallery_max:30,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'<div class="pp_pic_holder">

Look For this 寻找这个

jQuery.extend({hook:'rel'

And change to 并更改为

jQuery.extend({hook:'data-gal'

Alternatively you can download the version that I edited, its the latest version and be found here jquery.prettyPhoto-3.1.4-W3C.js 或者,您可以下载我编辑的版本,其最新版本,并在此处找到jquery.prettyPhoto-3.1.4-W3C.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM