2017-05-10 73 views
0

我的Featherlight畫廊需要點擊兩次才能激活。 你會碰巧知道爲什麼嗎? 這裏是我的代碼...爲什麼我的Featherlight畫廊需要點擊兩次才能激活?

的Javascript/jQuery的:

$(".woocommerce-product-gallery").attr({ 
    "data-featherlight-gallery" : "", 
    "data-featherlight-filter" : "a" 
}); 

HTML:

<div class="woocommerce-product-gallery"> 
    <figure class="product_gallery"> 
     <div data-thumb="THUMBNAIL_image.jpg" class="woocommerce-product-gallery__image"><a href="BIG_image.jpg"><img width="593" height="800" src="MEDIUM_image.jpg" data-src="BIG_image.jpg"></a></div> 
     <div data-thumb="THUMBNAIL_image2.jpg" class="woocommerce-product-gallery__image"><a href="BIG_image2.jpg"><img width="593" height="800" src="MEDIUM_image2.jpg"></a></div> 
     <div data-thumb="THUMBNAIL_image3.jpg" class="woocommerce-product-gallery__image"><a href="BIG_image3.jpg"><img width="593" height="800" src="MEDIUM_image3.jpg"></a></div> 
</figure> 

我無法擺脫的容器,因爲它們的一部分Woocommerce插件動態。

下面是示例:http://jadepalacecollective.com/product/shoes-4/ 單擊鞋子一次......然後兩次。看到?

回答

2

的Javascript控制檯顯示此錯誤:

"Featherlight: no content filter found (no target specified)"

在將圖像綁定到Featherlight後,通常會發生此錯誤。要防止出現此錯誤,您可以在動態添加圖像後手動綁定Featherlight:

$('woocommerce-product-gallery__wrapper').featherlight(); 
+0

嗨傑拉爾多。那條確切的線路並沒有解決它......但你是在正確的思路上。這是什麼結束了工作(通過設置羽毛屬性後): $('。woocommerce-product-gallery')。featherlightGallery(); \t \t 我會標記你的答案是正確的。非常感謝! –

+0

這爲我修好了! –

0

第一次單擊不因爲這個錯誤的工作:

Featherlight: no content filter found (no target specified)

線featherlight.js

您可以在畫廊首次點擊後,請檢查您的瀏覽器控制檯,你應該看到的227同樣的錯誤

相關問題