2016-08-23 48 views
1

我收到了几张图片,我想用(使用lightgallery)打开一个图库。所以我查了他们的文档,发现使用多个实例我必须包含lg-hash.js并为不同的画廊提供id。这正是我所做的,但第二个图像不起作用。它打开灯箱,但装载机只是不停地旋转。Lightgallery多个实例不起作用

我的代码:

<div id="hash"> 
    <a href="'.$fbimage.'"> 
     <img style="max-width:250px;" src="'.$fbimage.'"> 
    </a> 
</div> 
<div id="hash1"> 
    <a href="'.$block_image->{'image_intro'}.'"> 
     <img style="max-width:100%;" src="'.$block_image->{'image_intro'}.'"> 
    </a> 
<div> 

而且JS部分:

<script type="text/javascript"> 
$(document).ready(function() { 
    $("#hash").lightGallery({ 
     hash: true, 
     galleryId: 1 
    }); 
    $('#hash1').lightGallery({ 
     hash: true, 
     galleryId: 2 
    }); 
}); 
</script> 

第一个是工作,因为它应该,但第二图像没有加载,我不能关闭在第二个的lightgallery。

什么问题? Here is a link to their documentation

回答

0

在我看来,如果你没有JS部分的问题,但PHP部分... 你可以发布一个版本,它已经通过了PHP解析器? HTML在这里会有帮助。