【问题标题】:Jquery Lightbox 2 - image gallery on button clickJquery Lightbox 2 - 单击按钮上的图像库
【发布时间】:2016-08-18 18:59:01
【问题描述】:

我在我的一个基于 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>

如何在点击按钮时在灯箱中显示图片库? 任何建议将不胜感激...

谢谢!

【问题讨论】:

    标签: javascript jquery html lightbox2


    【解决方案1】:

    您必须调用 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>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-24
      • 2011-08-14
      相关资源
      最近更新 更多