HTML Attribute rel Errors using fancyBox

后端 未结 6 973
青春惊慌失措
青春惊慌失措 2020-11-28 11:25

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




        
6条回答
  •  不知归路
    2020-11-28 11:57

    The rel attribute specifies the relationship between the current document and the linked document. The attribute has a limited set of possible values, listed here: http://www.w3schools.com/tags/att_link_rel.asp. Using a non-standard value will cause a validation warning which can only be corrected by changing your rel attribute to a standard value or removing it altogether.

    I'm not quite sure why you have the attribute there, however there are several alternatives that will validate correctly:

    • If you are trying to store information against each item and your website uses the HTML5 doctype then you can use the data-* attribute. Example usage: data-group="1". You can then access the dataset via javascript, see here: http://slides.html5rocks.com/#custom-data
    • If you are trying to access the items in a css selector then you can add "group1" as a second class to the items.
    • If you are trying to access the items via JavaScript and you are not using the XHTML doctype you may alternatively consider setting their name attribute to "group1", then using the getElementsByName('group1') function.

提交回复
热议问题