当我动态设置我的 lightGallery 并使用“索引”来定位单击链接时应打开的图像时,除非是第一次单击,否则会显示错误的图像。
换句话说,如果您最初单击缩略图图像,您将看到在弹出的图库中选择了正确的较大图像。但是,如果您随后关闭该图像,然后单击不同的缩略图图像,您将看到错误的图像被放大(它抓住了您单击的第一个图像)。我认为这一定与“索引”功能在第一次点击后卡住有关?
我创建了一个 jsfiddle 来演示这个问题(对所有嵌套的 DIV 等表示歉意,但我相信这不是原因):http: //jsfiddle.net/fcdeLd03/18/
有人有想法么?
这是我启动 lightGallery 的 Javascript 代码:
$(".nodoubt").on('click', function(){
var slideID = $(this).attr('data-slide');
$("#lightgallery").lightGallery({
download: false,
dynamic: true,
dynamicEl: [{
"src": 'http://sachinchoolur.github.io/lightGallery/static/img/1.jpg',
'thumb': 'http://sachinchoolur.github.io/lightGallery/static/img/thumb-1.jpg',
'subHtml': 'Photo 1 by <a href="http://www.example.com" target="_blank">Photographer Name</a><br />More caption text.<br />Even more caption text.'
},{
"src": 'http://sachinchoolur.github.io/lightGallery/static/img/2.jpg',
'thumb': 'http://sachinchoolur.github.io/lightGallery/static/img/thumb-2.jpg',
'subHtml': 'Photo 2 by <a href="http://www.example.com" target="_blank">Photographer Name</a><br />More caption text.<br />Even more caption text.'
},{
"src": 'http://sachinchoolur.github.io/lightGallery/static/img/3.jpg',
'thumb': 'http://sachinchoolur.github.io/lightGallery/static/img/thumb-3.jpg',
'subHtml': 'Photo 3 by <a href="http://www.example.com" target="_blank">Photographer Name</a><br />More caption text.<br />Even more caption text.'
},],
index : slideID
});
});