我正在尝试在我的页面中使用“LighGallery.js” 。
情况:我有几组图像,每组应该显示在自己的画廊中。对于每个组,有 1 个可见图像,其余图像被隐藏,并在单击第一个可见图像时显示在图库中。
问题:图库仅触发第一个类别。它不会触发其余图像的图库视图。
问题:如何使用多个画廊实例。我似乎无法从文档中弄清楚。以前有人做过这个吗?
我尝试过的:我阅读并尝试使用随附的Hash插件。它仍然没有工作:
代码结构:
HTML:
<div class="topleft">
<!--Gallery 1st picture triggers-->
<ul>
<li>
<a class="gthumbnail gallery1" href="http://lorempixel.com/320/240"><img src="http://lorempixel.com/320/240" alt=""></a>
</li>
<li>
<a class="gthumbnail gallery2" href="http://lorempixel.com/320/240"><img src="http://lorempixel.com/320/240" alt=""></a>
</li>
</ul>
<!------------------->
<!--Individual galleries surrounded by DIVs-->
<div>
<a class="gallery1" href="http://lorempixel.com/320/240"><img src="http://lorempixel.com/320/240" alt=""></a>
<a class="gallery1" href="http://lorempixel.com/320/240"><img src="http://lorempixel.com/320/240" alt=""></a>
</div>
<div>
<a class="gallery2" href="http://lorempixel.com/320/240"><img src="http://lorempixel.com/320/240" alt=""></a>
<a class="gallery2" href="http://lorempixel.com/320/240"><img src="http://lorempixel.com/320/240" alt=""></a>
</div>
<!------------------->
</div>
JS:
$(".topleft").lightGallery({
thumbnail: true,
hash: true,
galleryId: "gallery1",
selector: '.gallery1'
});
$(".topleft").lightGallery({
thumbnail: true,
hash: true,
galleryId: "gallery2",
selector: '.gallery2'
});
谢谢