我在行中有多个图片,我希望Lightgallery能够捕获我页面上的所有图像。我似乎只能为每一行而不是一个大画廊设置单独的灯廊。出现问题是因为我在div中有多组图像,在一个大容器中有多个div。如何将retreats-image-container中的所有图像合并/合并/合并到一个图库中?
<div class="container-fluid" id="retreats-image-container">
<div class="row row-center">
<a href="img/retreats/retreats1.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats1.jpg" width="100%" height="100%" title="Special events" alt="Special events">
</div>
</a>
<a href="img/retreats/retreats2.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats2.jpg" width="100%" height="100%" title="Beauty and makeup" alt="Beauty and makeup">
</div>
</a>
<a href="img/retreats/retreats3.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats3.jpg" width="100%" height="100%" title="Special events" alt="Special events">
</div>
</a>
<a href="img/retreats/retreats4.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats4.jpg" width="100%" height="100%" title="Special events" alt="Special events">
</div>
</a>
</div>
<div class="row row-center">
<a href="img/retreats/retreats5.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats5.jpg" width="100%" height="100%"title="Special events" alt="Special events">
</div>
</a>
<a href="img/retreats/retreats6.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats6.jpg" width="100%" height="100%" title="Special events" alt="Special events">
</div>
</a>
<a href="img/retreats/retreats7.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats7.jpg" width="100%" height="100%" title="Special events" alt="Special events">
</div>
</a>
<a href="img/retreats/retreats8.jpg">
<div class="col-lg-3 col-sm-12 text-center retreats-img">
<img src="img/retreats/retreats8.jpg" width="100%" height="100%" title="Special events" alt="Special events">
</div>
</a>
</div>
</div>
javascript:
这将创建2个4个图像的画廊
$(document).ready(function() {
$(".row").lightGallery();
});
这不起作用,但它基本上是我想要获得一个8个图像的画廊
$(document).ready(function() {
$("#retreats-image_container").lightGallery();
});
答案 0 :(得分:7)
使用selector属性选择a
#retreats-image_container
标记
$(document).ready(function() {
$("#retreats-image_container").lightGallery({
selector: 'a'
});
});
您可以查看支持的标记列表here。