Here is a code that works!
(这是一个有效的代码!)
I tested it on https://sachinchoolur.github.io/lightgallery.js/demos/(我在https://sachinchoolur.github.io/lightgallery.js/demos/上进行了测试)
lg = document.getElementById('aniimated-thumbnials');
lg.addEventListener('onAfterSlide', function(event){
if (event.detail.index == (window.lgData.lg0.items.length - 1)) {
alert("This is the Last Slide!");
}
}, false);
lightGallery(lg);
In this code, change the following names/variables:
(在此代码中,更改以下名称/变量:)
aniimated-thumbnials - ID of the LightGallery
(动画的缩略图-LightGallery的 ID)
window.lgData.lg0 - window.lgData
holds data about all LightGallery on the web page.
(window.lgData.lg0 - window.lgData
保存有关网页上所有LightGallery的数据。)
So, first LightGallery is window.lgData.lg0
, second one is window.lgData.lg1
, and so on.(因此,第一个LightGallery是window.lgData.lg0
,第二个是window.lgData.lg1
,依此类推。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…