HTML属性rel使用fancyBox的错误 [英] HTML Attribute rel Errors using fancyBox

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

问题描述

 < a class =fancybox =group1href =img / work / 1.jpg>< / a> 
< a class =fancybox =group1href =img / work / 2.jpg>< / a>

但是在验证代码时出现错误。它说:

 元素a上属性rel的值为错误值group1:关键字group1未注册。 

我该如何解决这个问题?我没有正确写出代码吗?

谢谢。

如果你想在一个有效的 HTML 文档中有一个fancybox库(因为我们都是纯粹主义者),那么你需要两件事:



1:HTML5 DOCTYPE

 <!DOCTYPE html> 



<2>:使用 data-fancybox-group 属性而不是 rel 属性,如:

 < a class =fancyboxdata-fancybox-group =group1href =img / work / 1.jpg>< / a> 

验证!! ...请参阅此处示例



<注意:这是fancybox v2.x


I'm using fancyBox to create a gallery with the following code:

<a class="fancybox" rel="group1" href="img/work/1.jpg"></a>
<a class="fancybox" rel="group1" href="img/work/2.jpg"></a>
<a class="fancybox" rel="group1" href="img/work/3.jpg"><img src="img/th/thumb.jpg" alt="Thumb" /></a>

But I'm getting errors while validating the code. It says:

Bad value group1 for attribute rel on element a: Keyword group1 is not registered.

How do I fix this issue? Am I not writing the code out correctly? I basically wanted one thumbnail, with 3 photos to scroll through.

Thank you.

解决方案

If you want to have a fancybox gallery within a valid HTML document (just because we are all purists ;) then you need two things:

1: An HTML5 DOCTYPE

<!DOCTYPE html>

2: use the data-fancybox-group attribute rather than the rel attribute like:

<a class="fancybox" data-fancybox-group="group1" href="img/work/1.jpg"></a>

That validates!! ... see sample here

NOTE: this is for fancybox v2.x

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

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