我正在使用 justified Gallery jQuery 插件 ( http://miromannino.github.io/Justified-Gallery ) 构建我的图片库,并尝试将 lightGallery 插件 ( http://sachinchoolur.github.io/lightGallery ) 用作灯箱.
这是我用来触发两者的代码:
HTML:
<div id="mygallery">
<a href="imagepath/img.jpg"><img class="thumb" src="imagepath/img-thumb.jpg" alt="img description"></a>
<a href="imagepath/img.jpg"><img class="thumb" src="imagepath/img-thumb.jpg" alt="img description"></a></a>
</div>
JS:
$('#mygallery').justifiedGallery({
rowHeight: 120,
margins: 5,
}).on('jg.complete', function () {
$('#mygallery a').lightGallery({
thumbnail: true,
animateThumb: false,
showThumbByDefault: false
});