prettyPhoto的rel属性验证错误 [英] validation error on prettyPhoto's rel attribute

查看:139
本文介绍了prettyPhoto的rel属性验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来W3C的验证器会在prettyPhoto的HTML5页面的rel属性上返回验证错误。我该如何解决这个错误?

It is looks like W3C's validator return a validation error on prettyPhoto's rel attribute for HTML5 pages. How do I solve this error?

关于元素a的属性rel的错误值prettyPhoto [gallery1]:关键字prettyphoto [gallery1]未注册。

Bad value prettyPhoto[gallery1] for attribute rel on element a: Keyword prettyphoto[gallery1] is not registered.

非常感谢!

推荐答案

使用 rel 属性,其中非建议(因此不允许)的值对HTML5标记无效。值 prettyPhoto 不在建议值列表中。因此,您可能会遇到使图片库通过验证的网页遇到的困难。

Using rel attribute with non-proposed (thus not allowed) values not valid for HTML5 markup. Value prettyPhoto is not in the list of proposed values. So you may face the difficulties with getting your web-page with image gallery passing validation.

可能的解决方案:


  1. 打开 jquery.prettyPhoto.js (大概是非缩小的)并执行find&替换文本编辑器的功能:

    attr('data-gal'替换所有出现的 attr('rel') ')

  1. Open jquery.prettyPhoto.js (presumably non-minified one) and perform find & replace function of your text-editor:

    replace all occurrences of attr('rel') with attr('data-gal').

在您的图库代码中使用:

data-gal = prettyPhoto [galname]

而不是:


rel =prettyPhoto [galname]

In your gallery code use:

data-gal="prettyPhoto[galname]"

instead of:

rel="prettyPhoto[galname]"

使用以下内容初始化prettyPhoto:



jQuery(a [data-gal ^ ='prettyPhoto'])。prettyPhoto();



你正确的方式让你的代码有效!

Initialize your prettyPhoto with:

jQuery("a[data-gal^='prettyPhoto']").prettyPhoto();

And you are on the right way for getting your code valid!

您还可以阅读文章这个可能的解决方案。

You can also read this article with this possible solution.

这篇关于prettyPhoto的rel属性验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆