validation error on prettyPhoto's rel attribute

前端 未结 3 1384
感情败类
感情败类 2021-01-05 21:18

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?

Bad value prettyP

3条回答
  •  一个人的身影
    2021-01-05 21:48

    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.

    A Possible Solution:

    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').

    2. In your gallery code use:

      data-gal="prettyPhoto[galname]"

      instead of:

      rel="prettyPhoto[galname]"

    3. 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.

提交回复
热议问题