0

我正在使用Justified Gallery,我想将我的页面作为即时文章发布到 Facebook 上。当我浏览这里的文档时,我发现我可以通过Transformer Rules将图像转换为幻灯片。这是我的画廊代码:

<div class="myExMul">
     <a href="link_to_img" class="swipeboxImg">
         <img src="link_to_img" alt="example_text" class="myExMulImg">
     </a>
     <a href="link_to_img2" class="swipeboxImg">
         <img src="link_to_img2" alt="example_text2" class="myExMulImg">
     </a>
     <a href="link_to_img3" class="swipeboxImg">
         <img src="link_to_img3" alt="example_text3" class="myExMulImg">
     </a>
</div>

这是我的变压器规则:

{
   "class": "SlideshowRule",
   "selector": "div.myExMul",
},
{
    "class": "SlideshowImageRule",
    "selector": "img.myExMulImg",
    "properties": {
        "image.url": {
            "type": "string",
            "selector": "img.myExMulImg",
            "attribute": "src"
        },
        "caption.title": {
            "type": "string",
            "selector": "img.myExMulImg",
            "attribute": "alt"
        }
    }
}

当我导入规则时,似乎我的规则破坏了一切,我不能再发表我的文章,我在这里做错了什么?

4

1 回答 1

0

所以经过几个小时的研究,我为我的代码找到了正确的规则。问题是您必须使用外部标签作为选择器(在我的情况下是a标签)而不是内部标签(img)。

{
   "class": "SlideshowRule",
   "selector": "div.myExMul"
},
{
    "class": "SlideshowImageRule",
    "selector": "a.swipeboxImg",
    "properties": {
        "image.url": {
            "type": "string",
            "selector": "img",
            "attribute": "src"
        },
        "caption.title": {
            "type": "string",
            "selector": "img",
            "attribute": "alt"
        }
    }
}
于 2017-09-28T06:37:03.767 回答