我在我的一个基于 MVC 的应用程序中使用 jquery lightbox 2 插件。我们有来自数据库的相册及其各自的图像。
我列出了相册,并带有下面给出的链接,可指向相册库中的“查看所有”图像,其中包含那些动态创建的图像
<div id="albumGallery_@albumId" style="display:none">
@foreach (var image in albumImageList)
{
<a class="thumbnail" href="@actualImageName" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard.">
<img class="img-responsive" style="width:200px; height:150px;" src="@thumbnailImageName" alt="" />
</a>
}
</div>
如何在单击按钮时在灯箱中显示图片库? 任何建议将不胜感激...
谢谢!
最佳答案
您必须调用 start() 函数,并将构成图库的图像之一作为参数传递
<div id="albumGallery_@albumId" style="display:none">
<a href="#" onclick="lightbox.start($('#gallery_img_0')); return false;">
Show Gallery
</a>
@foreach (var image in albumImageList)
{
<a id="gallery_img_@imageIndex" class="thumbnail" href="@actualImageName" data-lightbox="example-set" data-title="Or press the right arrow on your keyboard.">
<img class="img-responsive" style="width:200px; height:150px;" src="@thumbnailImageName" alt="" />
</a>
}
</div>
关于javascript - Jquery Lightbox 2 - 单击按钮上的图像库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38611482/