lightGallery通过点击浏览按钮动态创建翻译

原创
小哥 3年前 (2022-12-26) 阅读数 87 #大杂烩

<button   id="dynamic"/>

javascript调用方法:

document.getElementById(dynamic).addEventListener(click, function() {
lightGallery(document.getElementById(dynamic), {
dynamic: true,
dynamicEl: [{
"src": ../static/img/1.jpg,//调用的图像路径
thumb: ../static/img/thumb-1.jpg,//可与上述相同
subHtml:

Fading Light

Classic view from Rigwood Jetty on Coniston Water an old archive shot similar to an old post but a little later on.

//图片下方有一点描述
}, {
src: ../static/img/2.jpg,
thumb: ../static/img/thumb-2.jpg,
subHtml: "

Bowness Bay

A beautiful Sunrise this morning taken En-route to Keswick not one as planned but Im extremely happy I was passing the right place at the right time....

"
}, {
src: ../static/img/3.jpg,
thumb: ../static/img/thumb-3.jpg,
subHtml: "

Coniston Calmness

Beautiful morning

"
}]//每一个{}代表的照片
})

});

具体可见

jquery调用方法:

$(#dynamic).on(click, function() {

$(this).lightGallery({
dynamic: true,
dynamicEl: [{
"src": ../static/img/1.jpg,
thumb: ../static/img/thumb-1.jpg,
subHtml:

Fading Light

Classic view from Rigwood Jetty on Coniston Water an old archive shot similar to an old post but a little later on.


}, {
src: ../static/img/2.jpg,
thumb: ../static/img/thumb-2.jpg,
subHtml: "

Bowness Bay

A beautiful Sunrise this morning taken En-route to Keswick not one as planned but Im extremely happy I was passing the right place at the right time....

"
}, {
src: ../static/img/3.jpg,
thumb: ../static/img/thumb-3.jpg,
subHtml: "

Coniston Calmness

Beautiful morning

"
}]
})

});

版权声明

所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除