Michel-FK 59d4c55298 reference lightbox images with alt tag
Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
2021-01-23 19:23:15 +01:00

25 lines
659 B
JavaScript

$(document).ready(function () {
let imageGroups = []
$(".lightbox").each(function () {
let imageSource = $(this).attr('src')
let imageAlt = $(this).attr('alt').replace(/ /g,"")
let imageTitle = $(this).attr('alt')
if (imageTitle) {
imageTitle = 'title="' + imageTitle + '" '
}
else {
imageTitle = ''
}
$(this).
wrap('<a class="boxedThumb ' + imageAlt + '" ' +
imageTitle + 'href="' + imageSource + '"></a>')
imageGroups.push('.' + imageAlt)
})
jQuery.unique(imageGroups)
imageGroups.forEach(imageGroupsSet)
function imageGroupsSet (value) {
$(value).simpleLightbox()
}
})