2017-05-10 72 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同样的错误

相关问题