2017-09-27 90 views
0

我正在使用Justified Gallery,我想在Facebook上發佈我的頁面作爲即時文章。當我瀏覽文檔here時,發現我可以通過Transformer Rules將圖像轉換爲Slideshow。這裏是我的畫廊代碼:在Facebook即時文章中幻燈片顯示的轉換器規則不起作用?

<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" 
     } 
    } 
} 

當我進口的規則,似乎我的規則打破了一切,我不能再發表我的文章,有什麼我在這裏做錯了嗎?

回答

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" 
     } 
    } 
}