
[英]How to append a dynamic element to an image opened in lightgallery.js
[英]How check the last image or last slide of lightgallery.js
这是一个有效的代码! 我在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);
在此代码中,更改以下名称/变量:
动画的缩略图-LightGallery的 ID
window.lgData.lg0 - window.lgData
保存有关网页上所有LightGallery的数据。 因此,第一个LightGallery是window.lgData.lg0
,第二个是window.lgData.lg1
,依此类推。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.